|
@@ -153,7 +153,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
initCountDownTimer()
|
|
|
initTransferCountDownTimer()
|
|
|
updateNetState()
|
|
|
- updateTime()
|
|
|
+ updateTime(true)
|
|
|
|
|
|
SpeechUtil.getInstance().init(this)
|
|
|
}
|
|
@@ -226,6 +226,8 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|
|
|
//门口机通话音量 没做白昼区分
|
|
|
SettingConfig.setDoorPhoneVolume(this, SettingConfiguration.getInstance().dayDoorVol)
|
|
|
+
|
|
|
+ updateTime(true)
|
|
|
}
|
|
|
|
|
|
fun checkApp() {
|
|
@@ -572,7 +574,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|| intent.action == Intent.ACTION_TIME_CHANGED
|
|
|
|| intent.action == Intent.ACTION_TIMEZONE_CHANGED) {
|
|
|
|
|
|
- updateTime()
|
|
|
+ updateTime(false)
|
|
|
updateNetState()
|
|
|
updateTcpState()
|
|
|
|
|
@@ -703,7 +705,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun updateTime() {
|
|
|
+ private fun updateTime(forceSet: Boolean) {
|
|
|
//根据时间判断白昼进行相关的配置设置
|
|
|
var currentTime = TimeTransition.getDateTime("yyyy-MM-dd HH:mm:ss")
|
|
|
//转时间戳
|
|
@@ -717,21 +719,27 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|
|
|
Log.e(TAG,"dayStartTimeStamp "+dayStartTimeStamp+" "+"endOfDayTimeStamp"+endOfDayTimeStamp)
|
|
|
|
|
|
- //白天
|
|
|
- if (dayStartTimeStamp < currentTimestamp && currentTimestamp < endOfDayTimeStamp) {
|
|
|
- //设置白天亮度
|
|
|
- ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getMainEngineDaytimeBrightness(this)).toInt())
|
|
|
- //设置白天系统音量和响铃音
|
|
|
- setTheSystemVolume(SettingConfig.getHostDaytimeVolume(this))
|
|
|
- day_night_state_imagev.setImageResource(R.drawable.ic_daylight)
|
|
|
- Constants.inday = true
|
|
|
- } else { //夜晚
|
|
|
- //设置晚上亮度
|
|
|
- ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getHostNightBrightness(this)).toInt())
|
|
|
- //设置晚上系统音量和响铃音
|
|
|
- setTheSystemVolume(SettingConfig.getHostNightVolume(this))
|
|
|
- day_night_state_imagev.setImageResource(R.drawable.ic_night)
|
|
|
- Constants.inday = false
|
|
|
+ val curInday = dayStartTimeStamp < currentTimestamp && currentTimestamp < endOfDayTimeStamp
|
|
|
+ if (curInday) {
|
|
|
+ //当前是白天并且原来不是白天
|
|
|
+ if (Constants.day_state != 0 || forceSet) {
|
|
|
+ //设置白天亮度
|
|
|
+ ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getMainEngineDaytimeBrightness(this)).toInt())
|
|
|
+ //设置白天系统音量和响铃音
|
|
|
+ setTheSystemVolume(SettingConfig.getHostDaytimeVolume(this))
|
|
|
+ day_night_state_imagev.setImageResource(R.drawable.ic_daylight)
|
|
|
+ }
|
|
|
+ Constants.day_state = 0
|
|
|
+ } else {
|
|
|
+ //当前是夜晚并且原来不是夜晚
|
|
|
+ if (Constants.day_state != 1 || forceSet) {
|
|
|
+ //设置晚上亮度
|
|
|
+ ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getHostNightBrightness(this)).toInt())
|
|
|
+ //设置晚上系统音量和响铃音
|
|
|
+ setTheSystemVolume(SettingConfig.getHostNightVolume(this))
|
|
|
+ day_night_state_imagev.setImageResource(R.drawable.ic_night)
|
|
|
+ }
|
|
|
+ Constants.day_state = 1
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -981,7 +989,7 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
|
|
|
//语音
|
|
|
if (SettingConfig.getTtsMode(activity) == SettingConfig.TTS_OFF) {
|
|
|
- RingPlayHelper.playRingTone(activity, R.raw.incoming_call, false)
|
|
|
+ RingPlayHelper.playRingTone(activity, R.raw.sos2, false)
|
|
|
} else {
|
|
|
SpeechUtil.getInstance().addSpeech(sosRoom + "紧急呼叫", true)
|
|
|
}
|
|
@@ -1065,12 +1073,16 @@ class NurseHomeActivity : BaseActivity<NurseHomeActivityPresenter, ActivityNurs
|
|
|
}
|
|
|
|
|
|
Constants.EVENT_NEW_CALL -> {
|
|
|
- if (Constants.CALL_STATE != Constants.CALL_CALLING) {
|
|
|
+ if (Constants.CALL_STATE != Constants.CALL_CALLING
|
|
|
+ && Constants.CALL_STATE != Constants.CALL_OUTGOING
|
|
|
+ && Constants.CALL_STATE != Constants.CALL_VISIT_CALLING) {
|
|
|
if (SettingConfig.getTtsMode(this) == SettingConfig.TTS_ON) {
|
|
|
val tcpModel = messageEvent.getMessage() as TcpModel
|
|
|
val interaction = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
|
|
|
val frameName = interaction.fromFrameFullName.replace("-", "")
|
|
|
SpeechUtil.getInstance().addSpeech(frameName + "呼叫", false)
|
|
|
+ } else {
|
|
|
+ RingPlayHelper.playRingTone(activity, R.raw.incoming_call_ring2, false)
|
|
|
}
|
|
|
}
|
|
|
EventBus.getDefault().post(MessageEvent(0, Constants.EVENT_REFRESH_CALL_LIST))
|