|
@@ -22,7 +22,7 @@ import com.wdkl.app.ncs.callingdoor.R
|
|
|
import com.wdkl.app.ncs.callingdoor.agreement.CallingdoorAgreement
|
|
|
import com.wdkl.app.ncs.callingdoor.bean.CallingItem
|
|
|
import com.wdkl.app.ncs.callingdoor.bean.Trans433Data
|
|
|
-import com.wdkl.app.ncs.callingdoor.databinding.CallingdoorMainLayBinding
|
|
|
+import com.wdkl.app.ncs.callingdoor.databinding.CallingdoorMainNewBinding
|
|
|
import com.wdkl.app.ncs.callingdoor.fragment.*
|
|
|
import com.wdkl.app.ncs.callingdoor.helper.*
|
|
|
import com.wdkl.app.ncs.callingdoor.launch.CallingdoorLaunch
|
|
@@ -69,6 +69,7 @@ import kotlinx.android.synthetic.main.callingdoor_main_lay.room_action_language_
|
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.tv_room_name
|
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay.view_flipper
|
|
|
import kotlinx.android.synthetic.main.callingdoor_main_lay_rk3288.*
|
|
|
+import kotlinx.android.synthetic.main.callingdoor_main_new.*
|
|
|
import kotlinx.android.synthetic.main.view_bed_name.*
|
|
|
import kotlinx.android.synthetic.main.view_title_layout.*
|
|
|
import okhttp3.OkHttpClient
|
|
@@ -95,17 +96,25 @@ import kotlin.collections.ArrayList
|
|
|
*/
|
|
|
|
|
|
@Router(path = "/callingdoor/main")
|
|
|
-class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, CallingdoorMainLayBinding>(), CallingdoorActivityContract.View, CallingdoorAgreement,
|
|
|
+class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, CallingdoorMainNewBinding>(), CallingdoorActivityContract.View, CallingdoorAgreement,
|
|
|
SerialPortUtil.ISerialPortBedOnclickEvent, SerialPortUtil.ISerialPortBedOnclickString, SerialPortUtil433.ISerialPort433Data {
|
|
|
+
|
|
|
var TAG = CallingdoorActivity::class.java.getSimpleName()
|
|
|
|
|
|
private lateinit var receiver: TimeReceiver
|
|
|
private var curFragment = ""
|
|
|
-
|
|
|
//首页
|
|
|
private val mainFragment = "main_fragment"
|
|
|
//二维码
|
|
|
private val qrFragment = "qr_fragment"
|
|
|
+ //医护
|
|
|
+ private val yhFragment = "yh_fragment"
|
|
|
+ //进入医护
|
|
|
+ private val NurseFragment = "nurse_fragment"
|
|
|
+
|
|
|
+// private val moreFragment = "more_fragment"
|
|
|
+ //更多
|
|
|
+ private val nwFragment = "nw_fragment"
|
|
|
//test
|
|
|
private val testFragment = "test_fragment"
|
|
|
|
|
@@ -122,7 +131,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
private var clickVersionTime : Long = 0
|
|
|
private var clickCount = 1
|
|
|
|
|
|
- private var serverSuccess = false
|
|
|
+
|
|
|
private var cancelRestart = false
|
|
|
private var copyDone = false
|
|
|
|
|
@@ -136,11 +145,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
private var netErrCount : Int = 0
|
|
|
|
|
|
override fun getLayId(): Int {
|
|
|
- if ("rk3288".equals(Build.MODEL)) {
|
|
|
- return R.layout.callingdoor_main_lay_rk3288
|
|
|
- } else {
|
|
|
- return R.layout.callingdoor_main_lay
|
|
|
- }
|
|
|
+ //这里来判断横屏还是竖屏
|
|
|
+ return R.layout.callingdoor_main_new
|
|
|
}
|
|
|
|
|
|
override fun bindDagger() {
|
|
@@ -150,32 +156,14 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
val languageId: Int = SettingConfig.getLanguageId(this)
|
|
|
LocaleMangerUtils.setApplicationLanguageByIndex(this, languageId)
|
|
|
-
|
|
|
super.onCreate(savedInstanceState)
|
|
|
}
|
|
|
|
|
|
override fun init() {
|
|
|
- //rk3288使用序列号注册,其他使用mac地址注册
|
|
|
- if ("rk3288".equals(Build.MODEL)) {
|
|
|
- val yfRk3288ApiManager = YF_RK3288_API_Manager(activity)
|
|
|
- //获取设备序列号
|
|
|
- Constant.DEVICE_SN = yfRk3288ApiManager.yfgetSerialNumber()
|
|
|
- Constant.DEVICE_REGISTER_ID = Constant.DEVICE_SN
|
|
|
-
|
|
|
- //点亮屏幕并设置为永不休眠
|
|
|
- yfRk3288ApiManager.yfSetLCDOn()
|
|
|
- AppTool.Setting.setScreenOffTimeOut(activity, 2147483647)
|
|
|
- } else {
|
|
|
- //获取mac地址
|
|
|
- Constant.LOCAL_MAC = NetHelper.getInstance().macAddress
|
|
|
- Constant.DEVICE_REGISTER_ID = Constant.LOCAL_MAC
|
|
|
- }
|
|
|
-
|
|
|
//presenter.loadTcpServerHost()
|
|
|
//注册广播
|
|
|
regReceiver()
|
|
|
RecordHelper.getInstance().init()
|
|
|
-
|
|
|
if (!EventBus.getDefault().isRegistered(this)) {
|
|
|
EventBus.getDefault().register(this)
|
|
|
}
|
|
@@ -187,21 +175,20 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
AppTool.Time.delay(1500) {
|
|
|
//串口监听
|
|
|
setSerialListener()
|
|
|
-
|
|
|
//打开MIC
|
|
|
SerialPortHelper.setMIC(false)
|
|
|
SerialPortHelper.setHandsFree(true)
|
|
|
SerialPortHelper.setSosLight("0")
|
|
|
//默认门灯白色
|
|
|
//SerialPortHelper.setDoorLight(1, "111")
|
|
|
-
|
|
|
- Constant.inNursing = SettingConfig.getInNursing(activity)
|
|
|
- if (Constant.inNursing) {
|
|
|
- nursingInteId = SettingConfig.getNursingId(activity)
|
|
|
- enterNursing()
|
|
|
- } else {
|
|
|
- SerialPortHelper.setDoorLight(0, "000")
|
|
|
- }
|
|
|
+ //护理状态
|
|
|
+// Constant.inNursing = SettingConfig.getInNursing(activity)
|
|
|
+// if (Constant.inNursing) {
|
|
|
+// nursingInteId = SettingConfig.getNursingId(activity)
|
|
|
+// enterNursing()
|
|
|
+// } else {
|
|
|
+// SerialPortHelper.setDoorLight(0, "000")
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
//设置默认时区为中国标准时间
|
|
@@ -218,10 +205,9 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
SpeechUtil.getInstance().setSpeechLoopCount(3)
|
|
|
|
|
|
- app_version.text = "V" + BuildConfig.VERSION_NAME
|
|
|
-
|
|
|
- //显示二维码界面
|
|
|
- switchFragment(R.id.callingdoor_main_frame, QrCodeFragment(), qrFragment)
|
|
|
+// app_version.text = "V" + BuildConfig.VERSION_NAME
|
|
|
+// //显示二维码界面
|
|
|
+// switchFragment(R.id.callingdoor_main_frame, QrCodeFragment(), qrFragment)
|
|
|
|
|
|
//记录app启动时间
|
|
|
val lastTime = SettingConfig.getAppStartTime(activity)
|
|
@@ -233,8 +219,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
//初始化soundpool
|
|
|
SoundPoolManager.getInstance().init()
|
|
|
-
|
|
|
- checkServer()
|
|
|
+ //请求设备信息
|
|
|
+ presenter.loadServerInfo()
|
|
|
|
|
|
if ("rk3128".equals(Build.MODEL)) {
|
|
|
checkLaunch()
|
|
@@ -247,8 +233,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
//3288 15.6寸竖屏:width=1080, height=1920
|
|
|
//3288 10.1寸竖屏:width=800, height=1280
|
|
|
Log.d(TAG, "device orientation: ${Constant.DEVICE_ORIENTATION}, width: ${dm.widthPixels}, height: ${dm.heightPixels}")
|
|
|
-
|
|
|
- startScheduledExecutor()
|
|
|
+ //显示分机呼叫
|
|
|
+// startScheduledExecutor()
|
|
|
}
|
|
|
|
|
|
//检查launch版本
|
|
@@ -315,89 +301,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
|
|
|
|
|
|
- private fun checkServer() {
|
|
|
- Thread {
|
|
|
- while (!serverSuccess) {
|
|
|
- val okHttpClient = OkHttpClient().newBuilder()
|
|
|
- .connectTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
|
|
|
- .readTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
|
|
|
- .writeTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
|
|
|
- .build()
|
|
|
- val url: String = CommonUtils.getUrl(BaseApplication.appContext)
|
|
|
- val port: String = CommonUtils.getUrlPort(BaseApplication.appContext)
|
|
|
- val request = Request.Builder()
|
|
|
- .url("http://$url:$port/ncs_url/server_info")
|
|
|
- .get()
|
|
|
- .build()
|
|
|
-
|
|
|
- try {
|
|
|
- val response = okHttpClient.newCall(request).execute()
|
|
|
- if (response != null && response.isSuccessful) {
|
|
|
- //接口数据获取成功,进入下一步获取设备信息
|
|
|
- serverSuccess = true
|
|
|
- presenter.loadServerInfo()
|
|
|
- } else {
|
|
|
- //接口数据获取失败,可能服务器ip不对,尝试重新获取服务器ip
|
|
|
- val info = ServerInfoUtil.get(Constant.DEVICE_REGISTER_ID!!)
|
|
|
- checkServerInfo(info)
|
|
|
- }
|
|
|
- } catch (e: Exception) {
|
|
|
- //接口数据获取失败,可能服务器ip不对,尝试重新获取服务器ip
|
|
|
- val info = ServerInfoUtil.get(Constant.DEVICE_REGISTER_ID!!)
|
|
|
- checkServerInfo(info)
|
|
|
- //e.printStackTrace()
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- Thread.sleep(30000)
|
|
|
- } catch (ex: Exception) {
|
|
|
- ex.printStackTrace()
|
|
|
- }
|
|
|
- }
|
|
|
- }.start()
|
|
|
- }
|
|
|
-
|
|
|
- private fun checkServerInfo(info: ThirdServerInfo?) {
|
|
|
- //检查获取到的服务器ip是否可用,可用则重启app重新初始化,不可用则什么都不做,等待下次重新获取服务器ip
|
|
|
- if (info != null) {
|
|
|
- if (info.thirdServer == null || info.thirdServerPort == null) {
|
|
|
- Log.d(TAG, "server info data null")
|
|
|
- showMsgMain("get server data null")
|
|
|
- } else {
|
|
|
- val okHttpClient = OkHttpClient().newBuilder()
|
|
|
- .connectTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
|
|
|
- .readTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
|
|
|
- .writeTimeout(15 * 1000L, TimeUnit.MILLISECONDS)
|
|
|
- .build()
|
|
|
- val request = Request.Builder()
|
|
|
- .url("http://${info.thirdServer}:${info.thirdServerPort}/ncs_url/server_info")
|
|
|
- .get()
|
|
|
- .build()
|
|
|
-
|
|
|
- try {
|
|
|
- val response = okHttpClient.newCall(request).execute()
|
|
|
- if (response != null && response.isSuccessful) {
|
|
|
- //接口数据获取成功,稍后重启app
|
|
|
- serverSuccess = true
|
|
|
- CommonUtils.setUrl(activity, info.thirdServer)
|
|
|
- CommonUtils.setUrlPort(activity, info.thirdServerPort.toString())
|
|
|
- showMsgMain("restart...")
|
|
|
- handler.postDelayed({
|
|
|
- if (!cancelRestart) {
|
|
|
- AppUpdateHelper.restartApp(activity)
|
|
|
- }
|
|
|
- }, 10000)
|
|
|
- }
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
- showMsgMain("server error or net error")
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- Log.d(TAG, "server info null")
|
|
|
- showMsgMain("get server null")
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
private fun startScheduledExecutor() {
|
|
|
val timerTask: TimerTask = object : TimerTask() {
|
|
@@ -410,11 +313,6 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
executor!!.scheduleAtFixedRate(timerTask, 100, 30, TimeUnit.SECONDS)
|
|
|
}
|
|
|
|
|
|
- private fun showMsgMain(msg: String) {
|
|
|
- runOnUiThread {
|
|
|
- showMessage(msg)
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
//测试模式
|
|
|
fun startTestMode() {
|
|
@@ -422,6 +320,20 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
switchFragment(R.id.callingdoor_main_frame, TestFragment(), testFragment)
|
|
|
}
|
|
|
}
|
|
|
+ //进入医护
|
|
|
+ fun startYhMode() {
|
|
|
+ if (!NurseFragment.equals(curFragment)) {
|
|
|
+ switchFragment(R.id.callingdoor_main_frame, NurseFragment(), NurseFragment)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //会到首页
|
|
|
+ fun BackMain() {
|
|
|
+ if (!mainFragment.equals(curFragment)) {
|
|
|
+ updateLeftBtState(mainFragment)
|
|
|
+ switchFragment(R.id.callingdoor_main_frame, MainFragment(), mainFragment)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
fun switchFragment(id: Int, fragment: Fragment, tag: String) {
|
|
|
supportFragmentManager.beginTransaction()
|
|
@@ -481,53 +393,78 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|
|
|
override fun bindEvent() {
|
|
|
//护理按钮
|
|
|
- room_action_nurse.setOnLongClickListener {
|
|
|
- if (!Constant.TCP_CONNECTED) {
|
|
|
- showMessage(R.string.net_error)
|
|
|
- return@setOnLongClickListener true
|
|
|
+// room_action_nurse.setOnLongClickListener {
|
|
|
+// if (!Constant.TCP_CONNECTED) {
|
|
|
+// showMessage(R.string.net_error)
|
|
|
+// return@setOnLongClickListener true
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (Constant.DEVICE_ID == -1) {
|
|
|
+// showMessage("null device id!")
|
|
|
+// return@setOnLongClickListener true
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (Constant.inNursing) {
|
|
|
+// Constant.inNursing = false
|
|
|
+// SettingConfig.setInNursing(activity, false)
|
|
|
+// exitNursing()
|
|
|
+//
|
|
|
+// if (Constant.DEVICE_ID != -1 && nursingInteId != -1) {
|
|
|
+// OtherUtil.sendNursingEnd(Constant.DEVICE_ID, nursingInteId)
|
|
|
+// nursingInteId = -1
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// Constant.inNursing = true
|
|
|
+// SettingConfig.setInNursing(activity, true)
|
|
|
+// enterNursing()
|
|
|
+//
|
|
|
+// if (Constant.DEVICE_ID != -1) {
|
|
|
+// OtherUtil.sendNursing(Constant.DEVICE_ID)
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// return@setOnLongClickListener true
|
|
|
+// }
|
|
|
+
|
|
|
+// room_action_nurse.setOnClickListener {
|
|
|
+// showMessage(R.string.enter_nursing_tips)
|
|
|
+// }
|
|
|
+ //首页
|
|
|
+ menu_home.setOnClickListener {
|
|
|
+ if (!mainFragment.equals(curFragment)) {
|
|
|
+ updateLeftBtState(mainFragment)
|
|
|
+ switchFragment(R.id.callingdoor_main_frame, MainFragment(), mainFragment)
|
|
|
}
|
|
|
|
|
|
- if (Constant.DEVICE_ID == -1) {
|
|
|
- showMessage("null device id!")
|
|
|
- return@setOnLongClickListener true
|
|
|
+ }
|
|
|
+ //医护
|
|
|
+ menu_medical_care.setOnClickListener {
|
|
|
+ if (!yhFragment.equals(curFragment)) {
|
|
|
+ updateLeftBtState(yhFragment)
|
|
|
+ switchFragment(R.id.callingdoor_main_frame, YhFragment(), yhFragment)
|
|
|
}
|
|
|
|
|
|
- if (Constant.inNursing) {
|
|
|
- Constant.inNursing = false
|
|
|
- SettingConfig.setInNursing(activity, false)
|
|
|
- exitNursing()
|
|
|
-
|
|
|
- if (Constant.DEVICE_ID != -1 && nursingInteId != -1) {
|
|
|
- OtherUtil.sendNursingEnd(Constant.DEVICE_ID, nursingInteId)
|
|
|
- nursingInteId = -1
|
|
|
- }
|
|
|
- } else {
|
|
|
- Constant.inNursing = true
|
|
|
- SettingConfig.setInNursing(activity, true)
|
|
|
- enterNursing()
|
|
|
-
|
|
|
- if (Constant.DEVICE_ID != -1) {
|
|
|
- OtherUtil.sendNursing(Constant.DEVICE_ID)
|
|
|
- }
|
|
|
+ }
|
|
|
+ //更多
|
|
|
+ menu_more.setOnClickListener {
|
|
|
+ if (!nwFragment.equals(curFragment)) {
|
|
|
+ updateLeftBtState(nwFragment)
|
|
|
+ switchFragment(R.id.callingdoor_main_frame, NursingWorkFragment(), nwFragment)
|
|
|
}
|
|
|
|
|
|
- return@setOnLongClickListener true
|
|
|
}
|
|
|
|
|
|
- room_action_nurse.setOnClickListener {
|
|
|
- showMessage(R.string.enter_nursing_tips)
|
|
|
- }
|
|
|
|
|
|
//增援按钮
|
|
|
- room_action_support.setOnClickListener {
|
|
|
+ menu_support.setOnClickListener {
|
|
|
if (Constant.TCP_CONNECTED) {
|
|
|
if (Constant.DEVICE_ID != -1) {
|
|
|
OtherUtil.sendReinforce(Constant.DEVICE_ID)
|
|
|
showMessage(R.string.support_sent)
|
|
|
- room_action_support.isEnabled = false
|
|
|
+ menu_support.isEnabled = false
|
|
|
AppTool.Time.delay(10000) {
|
|
|
//10s后才能再按
|
|
|
- room_action_support.isEnabled = true
|
|
|
+ menu_support.isEnabled = true
|
|
|
}
|
|
|
} else {
|
|
|
showMessage("null device id!")
|
|
@@ -537,8 +474,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //呼叫按钮
|
|
|
- room_action_call.setOnClickListener {
|
|
|
+ //呼叫护士按钮
|
|
|
+ menu_call_nurse.setOnClickListener {
|
|
|
val time = System.currentTimeMillis()
|
|
|
if (time - clickTime > 2000) {
|
|
|
//防止重复点击
|
|
@@ -563,8 +500,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
showMessage(R.string.wait_moment)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- room_action_call_bed.setOnClickListener {
|
|
|
+ //呼叫床位按钮
|
|
|
+ menu_call_bed.setOnClickListener {
|
|
|
if (Utils.getInBedVOS().size > 0) {
|
|
|
CallbedDialogHelper.showDialog(activity, object : CallbedDialogHelper.ClickListener {
|
|
|
override fun onVideoClick(bedVO: FrameBedVO?) {
|
|
@@ -588,64 +525,64 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //门口机取消分机呼叫
|
|
|
- room_cancel_call.setOnClickListener {
|
|
|
- if (Constant.TCP_CONNECTED) {
|
|
|
- if (Constant.DEVICE_ID != -1) {
|
|
|
- VoiceUtil.cancelCallByDoor(Constant.DEVICE_ID)
|
|
|
- } else {
|
|
|
- showMessage("null device id!")
|
|
|
- }
|
|
|
- } else {
|
|
|
- showMessage(R.string.net_error)
|
|
|
- }
|
|
|
-
|
|
|
- Constant.callNums == 0
|
|
|
- DoorLightHelper.resetDoorLight()
|
|
|
-
|
|
|
- SpeechUtil.getInstance().stopSpeak()
|
|
|
- bedCalls.clear()
|
|
|
- view_flipper.removeAllViews()
|
|
|
- }
|
|
|
-
|
|
|
- app_version.setOnLongClickListener {
|
|
|
- AppInfoDialogHelper.showAppDialog(activity,
|
|
|
- { dialog, which -> AppUpdateHelper.reboot(activity) },
|
|
|
- { dialog, which ->
|
|
|
- Constant.silentUpdate = false
|
|
|
- checkAppVersion()
|
|
|
- }, { dialog, which ->
|
|
|
- showMessage("debug enable")
|
|
|
- openNetwrokDebug()
|
|
|
- })
|
|
|
-
|
|
|
- return@setOnLongClickListener true
|
|
|
- }
|
|
|
+ //门口机取消分机呼叫(此处要修改)
|
|
|
+// room_cancel_call.setOnClickListener {
|
|
|
+// if (Constant.TCP_CONNECTED) {
|
|
|
+// if (Constant.DEVICE_ID != -1) {
|
|
|
+// VoiceUtil.cancelCallByDoor(Constant.DEVICE_ID)
|
|
|
+// } else {
|
|
|
+// showMessage("null device id!")
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// showMessage(R.string.net_error)
|
|
|
+// }
|
|
|
+//
|
|
|
+// Constant.callNums == 0
|
|
|
+// DoorLightHelper.resetDoorLight()
|
|
|
+//
|
|
|
+// SpeechUtil.getInstance().stopSpeak()
|
|
|
+// bedCalls.clear()
|
|
|
+// view_flipper.removeAllViews()
|
|
|
+// }
|
|
|
+ //长按 版本号出现 (此处需要调整)
|
|
|
+// app_version.setOnLongClickListener {
|
|
|
+// AppInfoDialogHelper.showAppDialog(activity,
|
|
|
+// { dialog, which -> AppUpdateHelper.reboot(activity) },
|
|
|
+// { dialog, which ->
|
|
|
+// Constant.silentUpdate = false
|
|
|
+// checkAppVersion()
|
|
|
+// }, { dialog, which ->
|
|
|
+// showMessage("debug enable")
|
|
|
+// openNetwrokDebug()
|
|
|
+// })
|
|
|
+//
|
|
|
+// return@setOnLongClickListener true
|
|
|
+// }
|
|
|
|
|
|
//if ("rk3288".equals(Build.MODEL)) {
|
|
|
- app_version.setOnClickListener {
|
|
|
- if (System.currentTimeMillis() - clickVersionTime < 1500) {
|
|
|
- clickCount++
|
|
|
- } else {
|
|
|
- clickCount = 1
|
|
|
- }
|
|
|
-
|
|
|
- if (clickCount == 5) {
|
|
|
- showMessage(R.string.enter_settings_tips)
|
|
|
- }
|
|
|
-
|
|
|
- if (clickCount > 7) {
|
|
|
- clickCount = 1
|
|
|
- AppTool.Setting.systemSetting(activity)
|
|
|
- }
|
|
|
- clickVersionTime = System.currentTimeMillis()
|
|
|
- }
|
|
|
+// app_version.setOnClickListener {
|
|
|
+// if (System.currentTimeMillis() - clickVersionTime < 1500) {
|
|
|
+// clickCount++
|
|
|
+// } else {
|
|
|
+// clickCount = 1
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (clickCount == 5) {
|
|
|
+// showMessage(R.string.enter_settings_tips)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (clickCount > 7) {
|
|
|
+// clickCount = 1
|
|
|
+// AppTool.Setting.systemSetting(activity)
|
|
|
+// }
|
|
|
+// clickVersionTime = System.currentTimeMillis()
|
|
|
+// }
|
|
|
//}
|
|
|
|
|
|
-
|
|
|
- room_action_language_set.setOnClickListener {
|
|
|
- LanguageSetDialogHelper.showDialog(activity)
|
|
|
- }
|
|
|
+// //语言设置
|
|
|
+// room_action_language_set.setOnClickListener {
|
|
|
+// LanguageSetDialogHelper.showDialog(activity)
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
//开启网络调试
|
|
@@ -852,6 +789,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
override fun showDeviceInfo(deviceInfo: DeviceRoomInfoVO) {
|
|
|
//显示床位信息界面
|
|
|
if (!mainFragment.equals(curFragment)) {
|
|
|
+ updateLeftBtState(mainFragment)
|
|
|
switchFragment(R.id.callingdoor_main_frame, MainFragment(), mainFragment)
|
|
|
}
|
|
|
|
|
@@ -866,6 +804,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
Constant.DEVICE_SOFT_VER = deviceInfo.softVer
|
|
|
Constant.DEVICE_HARD_VER = deviceInfo.hardVer
|
|
|
Constant.DEVICE_NAME = deviceInfo.name
|
|
|
+ Constant.DEVICE_INFO = Gson().toJson(deviceInfo)
|
|
|
if (deviceInfo.status != null) {
|
|
|
Constant.DEVICE_STATUS = deviceInfo.status
|
|
|
}
|
|
@@ -877,22 +816,21 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
if (TextUtils.isEmpty(Constant.SIP_ID)) {
|
|
|
showMessage("SIP ID empty")
|
|
|
}
|
|
|
- if (Constant.DEVICE_STATUS == 0) {
|
|
|
- tv_room_name.setText(R.string.device_disable)
|
|
|
- tv_room_name.setTextColor(resources.getColor(R.color.red_color))
|
|
|
- } else {
|
|
|
- tv_room_name.text = Constant.ROOM_NAME
|
|
|
- tv_room_name.setTextColor(resources.getColor(R.color.main_color))
|
|
|
- }
|
|
|
+ //显示床号(此处要处理)
|
|
|
+// if (Constant.DEVICE_STATUS == 0) {
|
|
|
+// tv_room_name.setText(R.string.device_disable)
|
|
|
+// tv_room_name.setTextColor(resources.getColor(R.color.red_color))
|
|
|
+// } else {
|
|
|
+// tv_room_name.text = Constant.ROOM_NAME
|
|
|
+// tv_room_name.setTextColor(resources.getColor(R.color.main_color))
|
|
|
+// }
|
|
|
|
|
|
if (deviceInfo.frameId != null) {
|
|
|
Constant.FRAME_ID = deviceInfo.frameId
|
|
|
//EventBus.getDefault().post(MessageEvent("updateCustom", Constant.EVENT_UPDATE_CUSTOM))
|
|
|
}
|
|
|
-
|
|
|
+ //请求设置参数
|
|
|
presenter.loadPartSettings(Constant.PART_ID)
|
|
|
-
|
|
|
-
|
|
|
//检查版本
|
|
|
Constant.silentUpdate = true
|
|
|
checkAppVersion()
|
|
@@ -929,23 +867,25 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
Constant.nurseValid = partSetting.nurseValid
|
|
|
}
|
|
|
|
|
|
- //按钮名称显示
|
|
|
- if (!TextUtils.isEmpty(partSetting.doorNurseTitle)) {
|
|
|
- room_action_call.visibility = View.VISIBLE
|
|
|
- room_action_call.text = partSetting.doorNurseTitle
|
|
|
- }
|
|
|
- if (partSetting.doorNurseValid != null && partSetting.doorNurseValid == 0) {
|
|
|
- room_action_call.visibility = View.GONE
|
|
|
- }
|
|
|
-
|
|
|
- if (!TextUtils.isEmpty(partSetting.doorNursingTitle)) {
|
|
|
- room_action_nurse.visibility = View.VISIBLE
|
|
|
- room_action_nurse.text = partSetting.doorNursingTitle
|
|
|
- Constant.NursingTitle = partSetting.doorNursingTitle
|
|
|
- }
|
|
|
- if (partSetting.doorNursingValid != null && partSetting.doorNursingValid == 0) {
|
|
|
- room_action_nurse.visibility = View.GONE
|
|
|
- }
|
|
|
+// //按钮名称显示
|
|
|
+// if (!TextUtils.isEmpty(partSetting.doorNurseTitle)) {
|
|
|
+// menu_call_nurse.visibility = View.VISIBLE
|
|
|
+// menu_call_nurse.text = partSetting.doorNurseTitle
|
|
|
+// }
|
|
|
+// if (partSetting.doorNurseValid != null && partSetting.doorNurseValid == 0) {
|
|
|
+// menu_call_nurse.visibility = View.GONE
|
|
|
+// }
|
|
|
+
|
|
|
+ //进入护理 ?设置名字
|
|
|
+// if (!TextUtils.isEmpty(partSetting.doorNursingTitle)) {
|
|
|
+// room_action_nurse.visibility = View.VISIBLE
|
|
|
+// room_action_nurse.text = partSetting.doorNursingTitle
|
|
|
+// Constant.NursingTitle = partSetting.doorNursingTitle
|
|
|
+// }
|
|
|
+
|
|
|
+// if (partSetting.doorNursingValid != null && partSetting.doorNursingValid == 0) {
|
|
|
+// room_action_nurse.visibility = View.GONE
|
|
|
+// }
|
|
|
|
|
|
//护理门灯颜色
|
|
|
if (partSetting.nursingColorRgb != null && partSetting.nursingColorRgb.length == 3 && TextUtils.isDigitsOnly(partSetting.nursingColorRgb)) {
|
|
@@ -1406,7 +1346,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}*/
|
|
|
}
|
|
|
-
|
|
|
+//分机呼叫显示
|
|
|
showCalls()
|
|
|
} catch (ex: Exception) {
|
|
|
ex.printStackTrace()
|
|
@@ -1414,30 +1354,30 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
|
|
|
private fun showCalls() {
|
|
|
- synchronized(Unit) {
|
|
|
- if (bedCalls.size > 0) {
|
|
|
- view_flipper.removeAllViews()
|
|
|
- for ((index, e) in bedCalls.withIndex()) {
|
|
|
- val textView = TextView(activity)
|
|
|
- textView.text = e.text
|
|
|
- textView.setSingleLine(true)
|
|
|
- textView.setEllipsize(TextUtils.TruncateAt.END)
|
|
|
- textView.setTextColor(Color.RED)
|
|
|
- if ("rk3288".equals(Build.MODEL)) {
|
|
|
- textView.textSize = 48f
|
|
|
- } else {
|
|
|
- textView.textSize = 32f
|
|
|
- }
|
|
|
- textView.gravity = (Gravity.END or Gravity.CENTER)
|
|
|
- //textView.getPaint().setFlags(mFlags);//字体划线
|
|
|
- //textView.setTypeface(null, mTypeface);//字体样式
|
|
|
-
|
|
|
- view_flipper.addView(textView, index)
|
|
|
- }
|
|
|
- } else {
|
|
|
- view_flipper.removeAllViews()
|
|
|
- }
|
|
|
- }
|
|
|
+// synchronized(Unit) {
|
|
|
+// if (bedCalls.size > 0) {
|
|
|
+// view_flipper.removeAllViews()
|
|
|
+// for ((index, e) in bedCalls.withIndex()) {
|
|
|
+// val textView = TextView(activity)
|
|
|
+// textView.text = e.text
|
|
|
+// textView.setSingleLine(true)
|
|
|
+// textView.setEllipsize(TextUtils.TruncateAt.END)
|
|
|
+// textView.setTextColor(Color.RED)
|
|
|
+// if ("rk3288".equals(Build.MODEL)) {
|
|
|
+// textView.textSize = 48f
|
|
|
+// } else {
|
|
|
+// textView.textSize = 32f
|
|
|
+// }
|
|
|
+// textView.gravity = (Gravity.END or Gravity.CENTER)
|
|
|
+// //textView.getPaint().setFlags(mFlags);//字体划线
|
|
|
+// //textView.setTypeface(null, mTypeface);//字体样式
|
|
|
+//
|
|
|
+// view_flipper.addView(textView, index)
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// view_flipper.removeAllViews()
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
private fun checkCalls() {
|
|
@@ -1468,13 +1408,13 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
this.runOnUiThread {
|
|
|
when (state) {
|
|
|
SipStatus.REGISTERING -> {
|
|
|
- view_title_layout_tv_point.setBackgroundResource(R.color.yellow_color)
|
|
|
+ view_title_layout_tv_point.setBackgroundResource(R.mipmap.sip_y)
|
|
|
}
|
|
|
SipStatus.REGISTERFAIL -> {
|
|
|
- view_title_layout_tv_point.setBackgroundResource(R.color.red_color)
|
|
|
+ view_title_layout_tv_point.setBackgroundResource(R.mipmap.sip_h)
|
|
|
}
|
|
|
SipStatus.REGISTERCOM -> {
|
|
|
- view_title_layout_tv_point.setBackgroundResource(R.color.green)
|
|
|
+ view_title_layout_tv_point.setBackgroundResource(R.mipmap.sip_b)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1535,13 +1475,33 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
private fun updateTcpState() {
|
|
|
if (Constant.TCP_CONNECTED) {
|
|
|
view_title_layout_iv_tcp.setImageResource(R.mipmap.ic_tcp_success)
|
|
|
- view_title_layout_tv_point.setBackgroundResource(R.color.green)
|
|
|
+ view_title_layout_tv_point.setBackgroundResource(R.mipmap.sip_b)
|
|
|
} else {
|
|
|
view_title_layout_iv_tcp.setImageResource(R.mipmap.ic_tcp_fail)
|
|
|
- view_title_layout_tv_point.setBackgroundResource(R.color.red_color)
|
|
|
+ view_title_layout_tv_point.setBackgroundResource(R.mipmap.sip_h)
|
|
|
}
|
|
|
}
|
|
|
+ private fun updateLeftBtState(state: String) {
|
|
|
+ menu_home.setBackgroundResource(R.drawable.shape_main_bt_bg)
|
|
|
+ menu_home.setTextColor(getResources().getColor(R.color.white));
|
|
|
+ menu_medical_care.setBackgroundResource(R.drawable.shape_main_bt_bg)
|
|
|
+ menu_medical_care.setTextColor(getResources().getColor(R.color.white));
|
|
|
+ menu_more.setBackgroundResource(R.drawable.shape_main_bt_bg)
|
|
|
+ menu_more.setTextColor(getResources().getColor(R.color.white));
|
|
|
+ if(state.equals(mainFragment)){
|
|
|
+ //首页
|
|
|
+ menu_home.setBackgroundResource(R.drawable.shape_main_bt_bg2)
|
|
|
+ menu_home.setTextColor(getResources().getColor(R.color.delete_text_color));
|
|
|
+ }else if(state.equals(yhFragment)){
|
|
|
+ menu_medical_care.setBackgroundResource(R.drawable.shape_main_bt_bg2)
|
|
|
+ menu_medical_care.setTextColor(getResources().getColor(R.color.delete_text_color));
|
|
|
+ }else{
|
|
|
+ menu_more.setBackgroundResource(R.drawable.shape_main_bt_bg2)
|
|
|
+ menu_more.setTextColor(getResources().getColor(R.color.delete_text_color));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
private fun updateSettings(forceSet: Boolean) {
|
|
|
val currentTimestamp = System.currentTimeMillis()
|
|
|
|