|
@@ -1,6 +1,7 @@
|
|
|
package com.wdkl.ncs.android.component.nursehome.activity
|
|
|
|
|
|
import android.Manifest
|
|
|
+import android.annotation.SuppressLint
|
|
|
import android.app.NotificationManager
|
|
|
import android.content.*
|
|
|
import android.content.pm.PackageManager
|
|
@@ -154,10 +155,20 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
/**
|
|
|
*初始化操作
|
|
|
*/
|
|
|
+ @SuppressLint("ClickableViewAccessibility")
|
|
|
override fun init() {
|
|
|
AppTool.SystemUI.showNavigationBar(this,false)
|
|
|
AppTool.SystemUI.ImmersiveWithBottomBarColor(this, Color.BLACK)
|
|
|
|
|
|
+ //事件点击穿透bug
|
|
|
+ ll_register_view.setOnTouchListener { v, event ->
|
|
|
+ return@setOnTouchListener true
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Build.BOARD.equals("k37mv1_64_bsp")) {
|
|
|
+ StatusBarHelper.toggleStatusBar(activity, true)
|
|
|
+ }
|
|
|
+
|
|
|
//申请权限
|
|
|
requestAppPermissions()
|
|
|
}
|
|
@@ -219,6 +230,33 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
|
|
|
//presenter.loadDeviceData(Constants.device_serial_id!!)
|
|
|
|
|
|
+ SpeechUtil.getInstance().init(activity) {
|
|
|
+ //如果tts启用失败或者不支持中文则将语音播报切换到音乐模式
|
|
|
+ if (!it) {
|
|
|
+ if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
|
|
|
+ SettingConfig.setTtsMode(activity, SettingConfig.TTS_OFF)
|
|
|
+ showMessage("当前TTS不可用,语音播报已切换至铃声模式")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Build.VERSION.SDK_INT >= 23) {
|
|
|
+ if (!Settings.canDrawOverlays(this)) {
|
|
|
+ val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
|
|
+ Uri.parse("package:$packageName"))
|
|
|
+ startActivityForResult(intent, 10)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Build.VERSION.SDK_INT >= 23) {
|
|
|
+ if (!Settings.System.canWrite(this)) {
|
|
|
+ val intent = Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS)
|
|
|
+ intent.data = Uri.parse("package:" + this.packageName)
|
|
|
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
+ startActivityForResult(intent, 11)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//检查服务器地址接口是否可用,可用则进入下一步获取设备信息,不可用则稍后再次尝试
|
|
|
checkServer()
|
|
|
}
|
|
@@ -424,18 +462,10 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
|
|
|
serverSuccess = true
|
|
|
currentFragment = FramePartFragment()
|
|
|
- supportFragmentManager.beginTransaction().add(R.id.middle_fralyout, currentFragment, "").commit()
|
|
|
+ supportFragmentManager.beginTransaction().add(R.id.middle_fralyout, currentFragment, "").commitAllowingStateLoss()
|
|
|
|
|
|
currentFragmentThree = CallRecordsFragment()
|
|
|
- supportFragmentManager.beginTransaction().add(R.id.left_framlyout, currentFragmentThree, "").commit()
|
|
|
-
|
|
|
- if (Build.VERSION.SDK_INT >= 23) {
|
|
|
- if (!Settings.canDrawOverlays(this)) {
|
|
|
- val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
|
|
- Uri.parse("package:$packageName"))
|
|
|
- startActivityForResult(intent, 10)
|
|
|
- }
|
|
|
- }
|
|
|
+ supportFragmentManager.beginTransaction().add(R.id.left_framlyout, currentFragmentThree, "").commitAllowingStateLoss()
|
|
|
|
|
|
//presenter.loadTcpData()
|
|
|
presenter.loadServerInfo()
|
|
@@ -457,16 +487,6 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
updateNetState()
|
|
|
updateTime(true)
|
|
|
|
|
|
- SpeechUtil.getInstance().init(activity) {
|
|
|
- //如果tts启用失败或者不支持中文则将语音播报切换到音乐模式
|
|
|
- if (!it) {
|
|
|
- if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_ON) {
|
|
|
- SettingConfig.setTtsMode(activity, SettingConfig.TTS_OFF)
|
|
|
- showMessage("当前TTS不可用,语音播报已切换至铃声模式")
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//初始化事件提醒window
|
|
|
incidentWindow = IncidentWindow(this.activity)
|
|
|
|
|
@@ -482,11 +502,23 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
val currentTime = TimeTransition.getDateTime(System.currentTimeMillis(), "MM-dd HH:mm:ss")
|
|
|
debugLog(TAG, "app last start time: $lastTime, current time: $currentTime")
|
|
|
SettingConfig.setAppStartTime(activity, currentTime)
|
|
|
+
|
|
|
+ if (Settings.canDrawOverlays(this) && Settings.System.canWrite(this)) {
|
|
|
+ if (Build.BOARD.equals("k37mv1_64_bsp")) {
|
|
|
+ StatusBarHelper.toggleStatusBar(activity, false)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override fun onResume() {
|
|
|
super.onResume()
|
|
|
updateTcpState()
|
|
|
+
|
|
|
+ if (initialized && Settings.canDrawOverlays(this) && Settings.System.canWrite(this)) {
|
|
|
+ if (Build.BOARD.equals("k37mv1_64_bsp")) {
|
|
|
+ StatusBarHelper.toggleStatusBar(activity, false)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -530,6 +562,10 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
Constants.sip_id = data.sipId
|
|
|
Constants.eth_ip = data.ethIp
|
|
|
|
|
|
+ if (data.hospitalId != null) {
|
|
|
+ Constants.hospital_id = data.hospitalId
|
|
|
+ }
|
|
|
+
|
|
|
Constants.DEVICE_CODE = data.code
|
|
|
Constants.DEVICE_MODEL = data.model
|
|
|
Constants.DEVICE_HARD_VER = data.hardVer
|
|
@@ -949,7 +985,6 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
R.id.broadcast_radio_bt ->{
|
|
|
if (select_id != 1) {
|
|
|
select_id = 1
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showRightFragment(BroadcastFragment())
|
|
|
}
|
|
|
}
|
|
@@ -957,13 +992,11 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
if (select_id != 2) {
|
|
|
select_id = 2
|
|
|
}
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showMiddleFragment(VisitManagementFragment())
|
|
|
}
|
|
|
R.id.doctor_host_radio_bt ->{
|
|
|
if (select_id != 3) {
|
|
|
select_id = 3
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showMiddleFragment(DoctorHostFragment())
|
|
|
}
|
|
|
}
|
|
@@ -977,28 +1010,24 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
R.id.sickbed_radio_bt ->{
|
|
|
if (select_id != 5) {
|
|
|
select_id = 5
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showMiddleFragment(SickbedFragment())
|
|
|
}
|
|
|
}
|
|
|
R.id.nurse_move_radio_bt ->{
|
|
|
if (select_id != 6) {
|
|
|
select_id = 6
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showMiddleFragment(NurseMoveFragment())
|
|
|
}
|
|
|
}
|
|
|
R.id.other_host_radio_bt ->{
|
|
|
if (select_id != 7) {
|
|
|
select_id = 7
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showMiddleFragment(OtherHostFragment())
|
|
|
}
|
|
|
}
|
|
|
R.id.collocation_radio_bt ->{
|
|
|
if (select_id != 8) {
|
|
|
select_id = 8
|
|
|
- //showLeftFragment(CallRecordsFragment())
|
|
|
showMiddleFragment(TrustManagementFragment())
|
|
|
}
|
|
|
}
|
|
@@ -1076,7 +1105,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
if (skyCallFragment != null) {
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
.remove(skyCallFragment)
|
|
|
- .commit()
|
|
|
+ .commitAllowingStateLoss()
|
|
|
skyCallFragment = null
|
|
|
}
|
|
|
|
|
@@ -1084,7 +1113,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
.setCustomAnimations(R.anim.slide_down_in, R.anim.slide_up_out)
|
|
|
.add(R.id.call_frame, fragment)
|
|
|
- .commit()
|
|
|
+ .commitAllowingStateLoss()
|
|
|
}
|
|
|
|
|
|
fun removeCallFragment() {
|
|
@@ -1092,17 +1121,17 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurse
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
//.setCustomAnimations(R.anim.slide_down_in, R.anim.slide_down_out)
|
|
|
.remove(skyCallFragment)
|
|
|
- .commit()
|
|
|
+ .commitAllowingStateLoss()
|
|
|
skyCallFragment = null
|
|
|
}
|
|
|
}
|
|
|
|
|
|
fun removeFragment(fragment: Fragment) {
|
|
|
- supportFragmentManager.beginTransaction().remove(fragment).commit()
|
|
|
+ supportFragmentManager.beginTransaction().remove(fragment).commitAllowingStateLoss()
|
|
|
}
|
|
|
|
|
|
inline fun FragmentManager.inTransaction(func: FragmentTransaction.() -> FragmentTransaction) {
|
|
|
- beginTransaction().func().commit()
|
|
|
+ beginTransaction().func().commitAllowingStateLoss()
|
|
|
}
|
|
|
|
|
|
/*
|