|
@@ -375,7 +375,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
SettingConfig.setSipOverTime(this, partSetting.sipOvertime)
|
|
|
SettingConfig.setSleepTime(this, partSetting.sleepSecondsDoor)
|
|
|
|
|
|
- updateSettings()
|
|
|
+ updateSettings(true)
|
|
|
}
|
|
|
|
|
|
override fun setTcpServerHost(tcpSeverDTO: TcpSeverDTO) {
|
|
@@ -566,6 +566,8 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
if (tcpModel.getAction() == TcpAction.DeviceAction.APP_UPDATE) {
|
|
|
Constant.silentUpdate = true
|
|
|
checkAppVersion()
|
|
|
+ } else if (tcpModel.action == TcpAction.DeviceAction.SYSTEM_SETTING) {
|
|
|
+ presenter.loadPartSettings(Constant.PART_ID)
|
|
|
}
|
|
|
} else if (tcpModel.action == TcpAction.DataAction.REFRESH) {
|
|
|
//重新加载数据
|
|
@@ -659,7 +661,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun updateSettings() {
|
|
|
+ private fun updateSettings(forceSet: Boolean) {
|
|
|
val currentTimestamp = System.currentTimeMillis()
|
|
|
|
|
|
//白天起始时间戳
|
|
@@ -668,23 +670,29 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
//白天结束时间戳
|
|
|
var endOfDayTimeStamp = TimeHandle.dateToStamp(date+" "+SettingConfig.getEndOfDay(this)+":00", "yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
|
- //白天
|
|
|
- if (dayStartTimeStamp < currentTimestamp && currentTimestamp < endOfDayTimeStamp) {
|
|
|
- //设置白天亮度
|
|
|
- ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getDaytimeBrightness(this)).toInt())
|
|
|
- //设置白天系统音量和响铃音
|
|
|
- VoiceManagerUtil.setSystemVoice(this, SettingConfig.getDoorDaytimeSystemVolume(this))
|
|
|
- VoiceManagerUtil.setMusicVoice(this, SettingConfig.getDoorDaytimeSystemVolume(this))
|
|
|
- view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_daylight)
|
|
|
- Constant.inday = true
|
|
|
+ val curInday = dayStartTimeStamp < currentTimestamp && currentTimestamp < endOfDayTimeStamp
|
|
|
+ if (curInday) {
|
|
|
+ //当前是白天并且原来不是白天
|
|
|
+ if (Constant.day_state != 0 || forceSet) {
|
|
|
+ //设置白天亮度
|
|
|
+ ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getDaytimeBrightness(this)).toInt())
|
|
|
+ //设置白天系统音量和响铃音
|
|
|
+ VoiceManagerUtil.setSystemVoice(this, SettingConfig.getDoorDaytimeSystemVolume(this))
|
|
|
+ VoiceManagerUtil.setMusicVoice(this, SettingConfig.getDoorDaytimeSystemVolume(this))
|
|
|
+ view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_daylight)
|
|
|
+ }
|
|
|
+ Constant.day_state = 0
|
|
|
} else {
|
|
|
- //设置晚上亮度
|
|
|
- ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getNightBrightness(this)).toInt())
|
|
|
- //设置晚上系统音量和响铃音
|
|
|
- VoiceManagerUtil.setSystemVoice(this, SettingConfig.getDoorNightSystemVolume(this))
|
|
|
- VoiceManagerUtil.setMusicVoice(this, SettingConfig.getDoorNightSystemVolume(this))
|
|
|
- view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_night)
|
|
|
- Constant.inday = false
|
|
|
+ //当前是夜晚并且原来不是夜晚
|
|
|
+ if (Constant.day_state != 1 || forceSet) {
|
|
|
+ //设置晚上亮度
|
|
|
+ ScreenManagerUtil().setScreenBrightness(this, Math.ceil(2.54 * SettingConfig.getNightBrightness(this)).toInt())
|
|
|
+ //设置晚上系统音量和响铃音
|
|
|
+ VoiceManagerUtil.setSystemVoice(this, SettingConfig.getDoorNightSystemVolume(this))
|
|
|
+ VoiceManagerUtil.setMusicVoice(this, SettingConfig.getDoorNightSystemVolume(this))
|
|
|
+ view_title_layout_iv_day_night.setImageResource(R.mipmap.ic_night)
|
|
|
+ }
|
|
|
+ Constant.day_state = 1
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -694,7 +702,7 @@ class CallingdoorActivity :BaseActivity<CallingdoorActivityPresenter, Callingdoo
|
|
|
|| intent.action == Intent.ACTION_TIME_CHANGED
|
|
|
|| intent.action == Intent.ACTION_TIMEZONE_CHANGED) {
|
|
|
updateNetState()
|
|
|
- updateSettings()
|
|
|
+ updateSettings(false)
|
|
|
|
|
|
if (SocketManager.getInstance().userState == 1) {
|
|
|
view_title_layout_tv_point.setBackgroundResource(R.color.green)
|