|
@@ -0,0 +1,683 @@
|
|
|
+package com.wdkl.ncs.android.component.nursehome.fragment
|
|
|
+
|
|
|
+import android.app.NotificationManager
|
|
|
+import android.content.Context
|
|
|
+import android.content.Intent
|
|
|
+import android.os.Build
|
|
|
+import android.provider.Settings
|
|
|
+import android.util.Log
|
|
|
+import android.view.View
|
|
|
+import android.widget.SeekBar
|
|
|
+import com.enation.javashop.net.engine.model.NetState
|
|
|
+import com.wdkl.ncs.android.component.nursehome.BuildConfig
|
|
|
+import com.wdkl.ncs.android.component.nursehome.R
|
|
|
+import com.wdkl.ncs.android.component.nursehome.activity.NurseHomeActivity
|
|
|
+import com.wdkl.ncs.android.component.nursehome.common.Constants
|
|
|
+import com.wdkl.ncs.android.component.nursehome.databinding.FragmentSystemSettingsBinding
|
|
|
+import com.wdkl.ncs.android.component.nursehome.launch.NurseHomeLaunch
|
|
|
+import com.wdkl.ncs.android.component.nursehome.settingconfig.SettingConfig
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.NetHelper
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.ScreenManagerUtil
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.VoiceManagerUtil
|
|
|
+import com.wdkl.ncs.android.component.nursehome.util.WarningDialogHelper
|
|
|
+import com.wdkl.ncs.android.lib.base.BaseFragment
|
|
|
+import com.wdkl.ncs.android.lib.utils.showMessage
|
|
|
+import com.wdkl.ncs.android.middleware.logic.contract.nursehome.SystemSettingsContract
|
|
|
+import com.wdkl.ncs.android.middleware.logic.presenter.nursehome.SystemSettingsPresenter
|
|
|
+import com.wdkl.ncs.android.middleware.model.bean.SettingConfiguration
|
|
|
+import com.wdkl.ncs.android.middleware.model.dos.PartSettingDO
|
|
|
+import com.wdkl.ncs.android.middleware.tcp.dto.TcpModel
|
|
|
+import com.wdkl.ncs.android.middleware.utils.MessageEvent
|
|
|
+import kotlinx.android.synthetic.main.fragment_system_settings.*
|
|
|
+import org.greenrobot.eventbus.Subscribe
|
|
|
+import org.greenrobot.eventbus.ThreadMode
|
|
|
+import java.io.DataOutputStream
|
|
|
+import java.io.IOException
|
|
|
+
|
|
|
+/**
|
|
|
+ * 设置Fragment
|
|
|
+ */
|
|
|
+class SystemSettingsFragment:BaseFragment<SystemSettingsPresenter,FragmentSystemSettingsBinding>(),SystemSettingsContract.View, View.OnClickListener, SeekBar.OnSeekBarChangeListener {
|
|
|
+ var TAG = SystemSettingsFragment::class.java.getSimpleName()
|
|
|
+ var partSettingDO = PartSettingDO()
|
|
|
+
|
|
|
+ private var clickTime: Long = 0
|
|
|
+ private var clickTimes: Int = 1
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提供layoutID
|
|
|
+ */
|
|
|
+ override fun getLayId(): Int {
|
|
|
+ return R.layout.fragment_system_settings
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *初始化依赖注入
|
|
|
+ */
|
|
|
+ override fun bindDagger() {
|
|
|
+ NurseHomeLaunch.component.inject(this)
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *初始化操作
|
|
|
+ */
|
|
|
+ override fun init() {
|
|
|
+ //设置白昼初始值和结束值
|
|
|
+ var initialValue = doubleslide_withoutrule.timeToArray(0, SettingConfig.getInitialDayTime(this.activity))
|
|
|
+ var endValue = doubleslide_withoutrule.timeToArray(1, SettingConfig.getEndOfDay(this.activity))
|
|
|
+
|
|
|
+ Log.e(TAG,"endValue "+endValue +" "+ SettingConfig.getEndOfDay(this.activity) + ", startValue: " + initialValue + " " + SettingConfig.getInitialDayTime(this.activity))
|
|
|
+// var initialValue = SettingConfig. getInitialDayTimeLocation(this.activity)
|
|
|
+// var endValue = SettingConfig.getEndOfDayLocation(this.activity)
|
|
|
+ doubleslide_withoutrule.update(initialValue,endValue)
|
|
|
+
|
|
|
+ if (SettingConfig.TTS_ON == SettingConfig.getTtsMode(this.activity)) {
|
|
|
+ if (Constants.TTS_STATUS == 2) {
|
|
|
+ radio_tts_on.isChecked = true
|
|
|
+ } else {
|
|
|
+ radio_tts_off.isChecked = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ radio_tts_off.isChecked = true
|
|
|
+ }
|
|
|
+
|
|
|
+ if (SettingConfig.getTransferCall(activity)) {
|
|
|
+ radio_transfer_on.isChecked = true
|
|
|
+ } else {
|
|
|
+ radio_transfer_off.isChecked = true
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 这里实际是应该从服务器拿或者本地拿数据显示
|
|
|
+ //语音播报次数
|
|
|
+ call_number_tv.text = SettingConfig.getCallNumber(this.activity).toString()
|
|
|
+ call_number_seekb.setProgress((SettingConfig.getCallNumber(this.activity)))
|
|
|
+ //主机白天亮度
|
|
|
+ main_engine_daytime_brightness_tv.text = SettingConfig.getMainEngineDaytimeBrightness(this.activity).toString()
|
|
|
+ main_engine_daytime_brightness_seekb.setProgress(SettingConfig.getMainEngineDaytimeBrightness(this.activity))
|
|
|
+ //主机晚上亮度
|
|
|
+ host_night_brightness_tv.text = SettingConfig.getHostNightBrightness(this.activity).toString()
|
|
|
+ host_night_brightness_tv_seekb.setProgress(SettingConfig.getHostNightBrightness(this.activity))
|
|
|
+ //todo 根据白天晚上设置亮度
|
|
|
+
|
|
|
+ //主机白天系统音量
|
|
|
+ host_daytime_volume_tv.text = SettingConfig.getHostDaytimeVolume(this.activity).toString()
|
|
|
+ host_daytime_volume_seekb.setProgress(SettingConfig.getHostDaytimeVolume(this.activity))
|
|
|
+ //主机晚上系统音量
|
|
|
+ host_night_volume_tv.text = SettingConfig.getHostNightVolume(this.activity).toString()
|
|
|
+ host_night_volume_seekb.setProgress(SettingConfig.getHostNightVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置系统音量
|
|
|
+
|
|
|
+ //主机免提录入音量
|
|
|
+ hands_free_input_volume_of_host_machine_tv.text = SettingConfig.getHandsFreeInputVolumeOfHostMachine(this.activity).toString()
|
|
|
+ hands_free_input_volume_of_host_machine_seekb.setProgress(SettingConfig.getHandsFreeInputVolumeOfHostMachine(this.activity))
|
|
|
+ //主机手柄免提录入音量
|
|
|
+ host_handle_input_volume_tv.text = SettingConfig.getHostHandleInputVolume(this.activity).toString()
|
|
|
+ host_handle_input_volume_seekb.setProgress(SettingConfig.getHostHandleInputVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置录入音量
|
|
|
+
|
|
|
+
|
|
|
+ //主机免提播放音量
|
|
|
+ host_hands_free_play_volume_tv.text = SettingConfig.getHostHandsFreePlayVolume(this.activity).toString()
|
|
|
+ host_hands_free_play_volume_seekb.setProgress(SettingConfig.getHostHandsFreePlayVolume(this.activity))
|
|
|
+ //主机手柄播放音量
|
|
|
+ host_gamepad_play_volume_tv.text = SettingConfig.getHostGamepadPlayVolume(this.activity).toString()
|
|
|
+ host_gamepad_play_volume_seekb.setProgress(SettingConfig.getHostGamepadPlayVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置播放音量
|
|
|
+
|
|
|
+ //通话模式
|
|
|
+ if(SettingConfig.single_pass_mode == SettingConfig.getTalkMode(this.activity)){
|
|
|
+ single_pass_mode_radiobt.isChecked = true
|
|
|
+ }else{
|
|
|
+ two_way_mode_radiobt.isChecked = true
|
|
|
+ }
|
|
|
+
|
|
|
+ //分机白天亮度设置
|
|
|
+ extension_daytime_brightness_tv.text = SettingConfig.getExtensionDaytimeBrightness(this.activity).toString()
|
|
|
+ extension_daytime_brightness_seekb.setProgress(SettingConfig.getExtensionDaytimeBrightness(this.activity))
|
|
|
+ //分机晚上亮度设置
|
|
|
+ extension_night_brightness_tv.text = SettingConfig.getExtensionNightBrightness(this.activity).toString()
|
|
|
+ extension_night_brightness_seekb.setProgress(SettingConfig.getExtensionNightBrightness(this.activity))
|
|
|
+ //todo 根据白天晚上设置分机亮度
|
|
|
+
|
|
|
+ //分机LED白天亮度设置
|
|
|
+ extension_daytime_led_brightness_tv.text = SettingConfig.getExtensionDaytimeLEDBrightness(this.activity).toString()
|
|
|
+ extension_daytime_led_brightness_seekb.setProgress(SettingConfig.getExtensionDaytimeLEDBrightness(this.activity))
|
|
|
+ //分机LED晚上亮度设置
|
|
|
+ extension_night_led_brightness_tv.text = SettingConfig.getExtensionNightLEDBrightness(this.activity).toString()
|
|
|
+ extension_night_led_brightness_seekb.setProgress(SettingConfig.getExtensionNightLEDBrightness(this.activity))
|
|
|
+ //todo 根据白天晚上设置分机led亮度
|
|
|
+
|
|
|
+
|
|
|
+ //分机白天系统音量设置
|
|
|
+ extension_daytime_system_volume_tv.text = SettingConfig.getExtensionDaytimeSystemVolume(this.activity).toString()
|
|
|
+ extension_daytime_system_volume_seekb.setProgress(SettingConfig.getExtensionDaytimeSystemVolume(this.activity))
|
|
|
+ //分机晚上统音量设置
|
|
|
+ extension_night_system_volume_tv.text = SettingConfig.getExtensionNightSystemVolume(this.activity).toString()
|
|
|
+ extension_night_system_volume_seekb.setProgress(SettingConfig.getExtensionNightSystemVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置分机系统音量
|
|
|
+
|
|
|
+ //分机手柄录入音量
|
|
|
+ the_extension_handle_records_the_volume_tv.text = SettingConfig.getTheExtensionHandleRecordsTheVolume(this.activity).toString()
|
|
|
+ the_extension_handle_records_the_volume_seekb.setProgress(SettingConfig.getTheExtensionHandleRecordsTheVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置分机系统音量
|
|
|
+
|
|
|
+
|
|
|
+ //分机通话音量
|
|
|
+ extension_call_volume_tv.text = SettingConfig.getExtensionCallVolume(this.activity).toString()
|
|
|
+ extension_call_volume_seekb.setProgress(SettingConfig.getExtensionCallVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置分机通话音量
|
|
|
+
|
|
|
+ //传统转换盒系统音量
|
|
|
+ change_box_system_volume_tv.text = SettingConfig.getChangeBoxSystemVolume(this.activity).toString()
|
|
|
+ change_box_system_volume_seekb.setProgress(SettingConfig.getChangeBoxSystemVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置传统转换盒系统音量
|
|
|
+
|
|
|
+ //门口机白天亮度设置
|
|
|
+ door_machine_daytime_brightness_tv.text = SettingConfig.getDoorMachineDaytimeBrightness(this.activity).toString()
|
|
|
+ door_machine_daytime_brightness_seekb.setProgress(SettingConfig.getDoorMachineDaytimeBrightness(this.activity))
|
|
|
+ //门口机晚上亮度设置
|
|
|
+ door_machine_night_brightness_tv.text = SettingConfig.getDoorMachineNightBrightness(this.activity).toString()
|
|
|
+ door_machine_night_brightness_seekb.setProgress(SettingConfig.getDoorMachineNightBrightness(this.activity))
|
|
|
+ //todo 根据白天晚上设置门口亮度
|
|
|
+
|
|
|
+ //门口机通话音量
|
|
|
+ door_phone_volume_tv.text = SettingConfig.getDoorPhoneVolume(this.activity).toString()
|
|
|
+ door_phone_volume_seekb.setProgress(SettingConfig.getDoorPhoneVolume(this.activity))
|
|
|
+ //todo 根据白天晚上设置门口通话音量
|
|
|
+ partSettingDO.id = SettingConfiguration.getInstance().id
|
|
|
+ partSettingDO.unionId = SettingConfiguration.getInstance().unionId
|
|
|
+ partSettingDO.createTime = SettingConfiguration.getInstance().createTime
|
|
|
+ partSettingDO.partId = Constants.part_id
|
|
|
+ partSettingDO.dayStart = SettingConfig. getInitialDayTime(this.activity)+":00"
|
|
|
+ partSettingDO.dayLight = SettingConfig.getMainEngineDaytimeBrightness(this.activity)
|
|
|
+ //partSettingDO.dayVol = SettingConfig.getHostDaytimeVolume(this.activity)
|
|
|
+ partSettingDO.dayVol = SettingConfiguration.getInstance().dayVol
|
|
|
+ partSettingDO.dayRingVol = SettingConfig.getHostDaytimeVolume(this.activity)
|
|
|
+ partSettingDO.dayRingTimes = SettingConfig.getCallNumber(this.activity)
|
|
|
+ partSettingDO.dayNurseLed = SettingConfig.getExtensionDaytimeLEDBrightness(this.activity)
|
|
|
+ partSettingDO.dayDoorVol = SettingConfig.getDoorPhoneVolume(this.activity)
|
|
|
+ partSettingDO.dayBedVol = SettingConfig.getExtensionDaytimeSystemVolume(this.activity)
|
|
|
+ partSettingDO.dayTransferBoxVol = SettingConfiguration.getInstance().dayTransferBoxVol
|
|
|
+ partSettingDO.dayTransferBoxSystemVol = SettingConfiguration.getInstance().dayTransferBoxSystemVol
|
|
|
+ partSettingDO.nightStart = SettingConfig.getEndOfDay(this.activity)+":00"
|
|
|
+ partSettingDO.nightLight = SettingConfig.getHostNightBrightness(this.activity)
|
|
|
+ //partSettingDO.nightVol = SettingConfig.getHostNightVolume(this.activity)
|
|
|
+ partSettingDO.nightVol = SettingConfiguration.getInstance().nightVol
|
|
|
+ partSettingDO.nightRingVol = SettingConfig.getHostNightVolume(this.activity)
|
|
|
+ partSettingDO.nightRingTimes = SettingConfig.getCallNumber(this.activity)
|
|
|
+ partSettingDO.nightNurseLed = SettingConfiguration.getInstance().nightNurseLed
|
|
|
+ partSettingDO.nightDoorVol = SettingConfiguration.getInstance().nightDoorVol
|
|
|
+ partSettingDO.nightBedVol = SettingConfig.getExtensionNightSystemVolume(this.activity)
|
|
|
+ partSettingDO.nightTransferBoxVol = SettingConfiguration.getInstance().nightTransferBoxVol
|
|
|
+ partSettingDO.nightTransferBoxSystemVol = SettingConfiguration.getInstance().nightTransferBoxSystemVol
|
|
|
+ partSettingDO.sleepSecondsNurse = SettingConfiguration.getInstance().sleepSecondsNurse
|
|
|
+ partSettingDO.sleepSecondsDoor = SettingConfiguration.getInstance().sleepSecondsDoor
|
|
|
+ partSettingDO.sleepSecondsBed = SettingConfiguration.getInstance().sleepSecondsBed
|
|
|
+ partSettingDO.sipOvertime = SettingConfiguration.getInstance().sipOvertime
|
|
|
+ partSettingDO.transferDuration = SettingConfiguration.getInstance().transferDuration
|
|
|
+ partSettingDO.transferDurationLeader = SettingConfiguration.getInstance().transferDurationLeader
|
|
|
+
|
|
|
+
|
|
|
+ software_and_information_tv.setText("软件版本: V" + BuildConfig.VERSION_NAME + "_" + BuildConfig.VERSION_CODE)
|
|
|
+ software_and_information_tv.setOnLongClickListener {
|
|
|
+ (activity as NurseHomeActivity).checkApp()
|
|
|
+
|
|
|
+ return@setOnLongClickListener true
|
|
|
+ }
|
|
|
+ software_and_information_tv.setOnClickListener {
|
|
|
+ val time = System.currentTimeMillis()
|
|
|
+ if (time - clickTime < 1500) {
|
|
|
+ clickTimes++
|
|
|
+ } else {
|
|
|
+ clickTimes = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ if (clickTimes > 9) {
|
|
|
+ openNetwrokDebug()
|
|
|
+ clickTimes = 1
|
|
|
+ }
|
|
|
+ clickTime = time
|
|
|
+ }
|
|
|
+ tv_device_ip.setText(NetHelper.getInstance().localIP)
|
|
|
+
|
|
|
+ save_settings_tv.setOnClickListener(this)
|
|
|
+ system_settings_tv.setOnClickListener(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ //开启网络调试
|
|
|
+ private fun openNetwrokDebug() {
|
|
|
+ val commands = arrayListOf(
|
|
|
+ "/system/bin/sh",
|
|
|
+ "setprop service.adb.tcp.port 5555",
|
|
|
+ "stop adbd",
|
|
|
+ "start adbd"
|
|
|
+ )
|
|
|
+ try {
|
|
|
+ RunAsRoot(commands)
|
|
|
+ showMessage("打开调试")
|
|
|
+ } catch (e: IOException) {
|
|
|
+ e.printStackTrace()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun RunAsRoot(cmds: ArrayList<String>) {
|
|
|
+ val p = Runtime.getRuntime().exec("su")
|
|
|
+ val os = DataOutputStream(p.outputStream)
|
|
|
+ for (tmpCmd in cmds) {
|
|
|
+ os.writeBytes(
|
|
|
+ """
|
|
|
+ $tmpCmd
|
|
|
+
|
|
|
+ """.trimIndent()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ os.writeBytes("exit\n")
|
|
|
+ os.flush()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *绑定事件
|
|
|
+ */
|
|
|
+ override fun bindEvent() {
|
|
|
+//白昼监听
|
|
|
+ doubleslide_withoutrule.setOnRangeListener { low, big, lowTime, bigTime ->
|
|
|
+ SettingConfig.setInitialDayTimeLocation(this.activity, String.format("%.0f", low))
|
|
|
+ SettingConfig.setInitialDayTime(this.activity,lowTime)
|
|
|
+ SettingConfig.setEndOfDayLocation(this.activity, String.format("%.0f", big))
|
|
|
+ SettingConfig.setEndOfDay(this.activity,bigTime)
|
|
|
+
|
|
|
+ partSettingDO.dayStart = lowTime+":00"
|
|
|
+ partSettingDO.nightStart = bigTime+":00"
|
|
|
+ }
|
|
|
+
|
|
|
+ group_tts_set.setOnCheckedChangeListener { group, checkedId ->
|
|
|
+ if (checkedId == R.id.radio_tts_on) {
|
|
|
+ if (Constants.TTS_STATUS == 2) {
|
|
|
+ showMessage("TTS启用成功")
|
|
|
+ SettingConfig.setTtsMode(this.activity, SettingConfig.TTS_ON)
|
|
|
+ } else {
|
|
|
+ showMessage("TTS不可用,请检查是否已经安装TTS服务")
|
|
|
+ radio_tts_off.isChecked = true
|
|
|
+ SettingConfig.setTtsMode(this.activity, SettingConfig.TTS_OFF)
|
|
|
+ }
|
|
|
+ } else if (checkedId == R.id.radio_tts_off) {
|
|
|
+ SettingConfig.setTtsMode(this.activity, SettingConfig.TTS_OFF)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ group_call_transfer.setOnCheckedChangeListener { group, checkedId ->
|
|
|
+ if (checkedId == R.id.radio_transfer_on) {
|
|
|
+ SettingConfig.setTransferCall(activity, true)
|
|
|
+ WarningDialogHelper.showDialog(activity)
|
|
|
+ } else {
|
|
|
+ SettingConfig.setTransferCall(activity, false)
|
|
|
+ WarningDialogHelper.showDialog(activity)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //播报次数加减
|
|
|
+ call_number_decrease_tv.setOnClickListener(this)
|
|
|
+ call_number_add_tv.setOnClickListener(this)
|
|
|
+ call_number_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //主机白天夜晚亮度设置
|
|
|
+ main_engine_daytime_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ host_night_brightness_tv_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //主机白天晚上声音设置
|
|
|
+ host_daytime_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ host_night_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //主机录入音量设置
|
|
|
+ hands_free_input_volume_of_host_machine_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ host_handle_input_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //主机播放音量设置
|
|
|
+ host_hands_free_play_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ host_gamepad_play_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //通话模式
|
|
|
+ talk_mode_radiogrp.setOnCheckedChangeListener { radioGroup, i ->
|
|
|
+ if(i == R.id.single_pass_mode_radiobt){//单工模式
|
|
|
+ SettingConfig.setTalkMode(this.activity,SettingConfig.single_pass_mode)
|
|
|
+
|
|
|
+ }else if(i == R.id.two_way_mode_radiobt){//双工模式
|
|
|
+ SettingConfig.setTalkMode(this.activity, SettingConfig.two_way_mode)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //分机亮度设置
|
|
|
+ extension_daytime_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ extension_night_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //分机LED亮度设置
|
|
|
+ extension_daytime_led_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ extension_night_led_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //分机系统声音设置
|
|
|
+ extension_daytime_system_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ extension_night_system_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //分机手柄录入音量
|
|
|
+ the_extension_handle_records_the_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //分机通话音量
|
|
|
+ extension_call_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //传统转换盒系统音量
|
|
|
+ change_box_system_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //门口机晚上亮度音量
|
|
|
+ door_machine_daytime_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ door_machine_night_brightness_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ //门口机晚上亮度音量
|
|
|
+ door_phone_volume_seekb.setOnSeekBarChangeListener(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onClick(p0: View) {
|
|
|
+ when (p0.id) {
|
|
|
+ R.id.call_number_decrease_tv -> {
|
|
|
+ call_number_seekb.setProgress(call_number_seekb.progress - 1)
|
|
|
+ partSettingDO.dayRingTimes = call_number_seekb.progress
|
|
|
+ partSettingDO.nightRingTimes = call_number_seekb.progress
|
|
|
+ SettingConfig.setCallNumber(this.activity, partSettingDO.dayRingTimes)
|
|
|
+ }
|
|
|
+ R.id.call_number_add_tv -> {
|
|
|
+ call_number_seekb.setProgress(call_number_seekb.progress + 1)
|
|
|
+ partSettingDO.dayRingTimes = call_number_seekb.progress
|
|
|
+ partSettingDO.nightRingTimes = call_number_seekb.progress
|
|
|
+ SettingConfig.setCallNumber(this.activity, partSettingDO.dayRingTimes)
|
|
|
+ }
|
|
|
+ R.id.save_settings_tv -> {
|
|
|
+ uploadingData(partSettingDO)
|
|
|
+ }
|
|
|
+ R.id.system_settings_tv -> {
|
|
|
+ val intent = Intent(Settings.ACTION_SETTINGS)
|
|
|
+ startActivity(intent)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 滑动过程调用
|
|
|
+ */
|
|
|
+ override fun onProgressChanged(p0: SeekBar, p1: Int, p2: Boolean) {
|
|
|
+ when (p0.id) {
|
|
|
+ R.id.call_number_seekb -> { //播报次数
|
|
|
+ call_number_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.main_engine_daytime_brightness_seekb -> {//主机白天亮度
|
|
|
+ main_engine_daytime_brightness_tv.text = p1.toString()
|
|
|
+ ScreenManagerUtil().setScreenBrightness(this.activity, Math.ceil(2.54 * p1).toInt())
|
|
|
+ }
|
|
|
+ R.id.host_night_brightness_tv_seekb -> {//主机夜晚亮度
|
|
|
+ host_night_brightness_tv.text = p1.toString()
|
|
|
+ ScreenManagerUtil().setScreenBrightness(this.activity, Math.ceil(2.54 * p1).toInt())
|
|
|
+ }
|
|
|
+ R.id.host_daytime_volume_seekb -> { //主机白天系统音量
|
|
|
+ host_daytime_volume_tv.text = p1.toString()
|
|
|
+ setTheSystemVolume(p1)
|
|
|
+ }
|
|
|
+ R.id.host_night_volume_seekb -> { //主机夜晚系统音量
|
|
|
+ host_night_volume_tv.text = p1.toString()
|
|
|
+ setTheSystemVolume(p1)
|
|
|
+ }
|
|
|
+ R.id.hands_free_input_volume_of_host_machine_seekb -> { //主机免提录入音量
|
|
|
+ hands_free_input_volume_of_host_machine_tv.text = p1.toString()
|
|
|
+ //todo 这里需要配合语音通话 视屏通话通讯使用
|
|
|
+ }
|
|
|
+ R.id.host_handle_input_volume_seekb -> { //主机手柄录入音量
|
|
|
+ host_handle_input_volume_tv.text = p1.toString()
|
|
|
+ //todo 这里需要配合语音通话 视屏通话通讯使用
|
|
|
+ }
|
|
|
+ R.id.host_hands_free_play_volume_seekb -> { //主机免提播放音量
|
|
|
+ host_hands_free_play_volume_tv.text = p1.toString()
|
|
|
+ //todo 这里需要配合语音通话 视屏通话通讯使用
|
|
|
+ }
|
|
|
+ R.id.host_gamepad_play_volume_seekb -> { //主机手柄播放音量
|
|
|
+ host_gamepad_play_volume_tv.text = p1.toString()
|
|
|
+ //todo 这里需要配合语音通话 视屏通话通讯使用
|
|
|
+ }
|
|
|
+ R.id.extension_daytime_brightness_seekb -> { //分机白天亮度设置
|
|
|
+ extension_daytime_brightness_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.extension_night_brightness_seekb -> { //分机晚上亮度设置
|
|
|
+ extension_night_brightness_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.extension_daytime_led_brightness_seekb -> { //分机LED白天亮度设置
|
|
|
+ extension_daytime_led_brightness_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.extension_night_led_brightness_seekb -> { //分机LED晚上亮度设置
|
|
|
+ extension_night_led_brightness_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.extension_daytime_system_volume_seekb -> { //分机白天系统音量
|
|
|
+ extension_daytime_system_volume_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.extension_night_system_volume_seekb -> { //分机晚上系统音量
|
|
|
+ extension_night_system_volume_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.the_extension_handle_records_the_volume_seekb -> { //分机手柄录入音量
|
|
|
+ the_extension_handle_records_the_volume_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.extension_call_volume_seekb -> { //分机通话音量
|
|
|
+ extension_call_volume_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.change_box_system_volume_seekb -> { //传统转换盒系统音量
|
|
|
+ change_box_system_volume_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.door_machine_daytime_brightness_seekb -> { //门口机白天亮度
|
|
|
+ door_machine_daytime_brightness_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.door_machine_night_brightness_seekb -> { //门口机晚上亮度
|
|
|
+ door_machine_night_brightness_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+ R.id.door_phone_volume_seekb -> { //门口机通话音量
|
|
|
+ door_phone_volume_tv.text = p1.toString()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 滑动开始调用
|
|
|
+ */
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 滑动停止调用
|
|
|
+ */
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar) {
|
|
|
+ //todo 保存到本地并上传到服务器
|
|
|
+ when (p0.id) {
|
|
|
+ R.id.call_number_seekb -> { //播报次数
|
|
|
+ SettingConfig.setCallNumber(this.activity,p0.progress)
|
|
|
+ partSettingDO.dayRingTimes = p0.progress
|
|
|
+ partSettingDO.nightRingTimes = p0.progress
|
|
|
+ }
|
|
|
+ R.id.main_engine_daytime_brightness_seekb -> { //主机白天亮度
|
|
|
+ SettingConfig.setMainEngineDaytimeBrightness(this.activity,p0.progress)
|
|
|
+ partSettingDO.dayLight = p0.progress
|
|
|
+ }
|
|
|
+ R.id.host_night_brightness_tv_seekb -> { //主机夜晚亮度
|
|
|
+ SettingConfig.setHostNightBrightness(this.activity,p0.progress)
|
|
|
+ partSettingDO.nightLight = p0.progress
|
|
|
+ }
|
|
|
+ R.id.host_daytime_volume_seekb -> { //主机白天系统音量
|
|
|
+ SettingConfig.setHostDaytimeVolume(this.activity,p0.progress)
|
|
|
+ //partSettingDO.dayVol = p0.progress
|
|
|
+ partSettingDO.dayRingVol = p0.progress
|
|
|
+ }
|
|
|
+ R.id.host_night_volume_seekb -> { //主机夜晚系统音量
|
|
|
+ SettingConfig.setHostNightVolume(this.activity,p0.progress)
|
|
|
+ //partSettingDO.nightVol = p0.progress
|
|
|
+ partSettingDO.nightRingVol = p0.progress
|
|
|
+ }
|
|
|
+
|
|
|
+ R.id.hands_free_input_volume_of_host_machine_seekb -> { //主机免提录入音量
|
|
|
+ SettingConfig.setHandsFreeInputVolumeOfHostMachine(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.host_handle_input_volume_seekb -> { //主机手柄录入音量
|
|
|
+ SettingConfig.setHostHandleInputVolume(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.host_hands_free_play_volume_seekb -> { //主机免提播放音量
|
|
|
+ SettingConfig.setHostHandsFreePlayVolume(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.host_gamepad_play_volume_seekb -> { //主机手柄播放音量
|
|
|
+ SettingConfig.setHostGamepadPlayVolume(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.extension_daytime_brightness_seekb -> { //分机白天亮度设置
|
|
|
+ SettingConfig.setExtensionDaytimeBrightness(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.extension_night_brightness_seekb -> { //分机晚上亮度设置
|
|
|
+ SettingConfig.setExtensionNightBrightness(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.extension_daytime_led_brightness_seekb -> { //分机LED白天亮度设置
|
|
|
+ SettingConfig.setExtensionDaytimeLEDBrightness(this.activity,p0.progress)
|
|
|
+ partSettingDO.dayNurseLed = p0.progress
|
|
|
+ }
|
|
|
+ R.id.extension_night_led_brightness_seekb -> { //分机LED晚上亮度设置
|
|
|
+ SettingConfig.setExtensionNightLEDBrightness(this.activity,p0.progress)
|
|
|
+ partSettingDO.nightNurseLed = p0.progress
|
|
|
+ }
|
|
|
+ R.id.extension_daytime_system_volume_seekb -> { //分机白天系统音量
|
|
|
+ SettingConfig.setExtensionDaytimeSystemVolume(this.activity,p0.progress)
|
|
|
+ partSettingDO.dayBedVol = p0.progress
|
|
|
+ }
|
|
|
+ R.id.extension_night_system_volume_seekb -> { //分机晚上系统音量
|
|
|
+ SettingConfig.setExtensionNightSystemVolume(this.activity,p0.progress)
|
|
|
+ partSettingDO.nightBedVol = p0.progress
|
|
|
+ }
|
|
|
+ R.id.the_extension_handle_records_the_volume_seekb -> { //分机手柄录入音量
|
|
|
+ SettingConfig.setTheExtensionHandleRecordsTheVolume(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.extension_call_volume_seekb -> { //分机通话音量
|
|
|
+ SettingConfig.setExtensionCallVolume(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.change_box_system_volume_seekb -> { //传统转换盒系统音量
|
|
|
+ SettingConfig.setChangeBoxSystemVolume(this.activity,p0.progress)
|
|
|
+ partSettingDO.dayTransferBoxSystemVol = p0.progress
|
|
|
+ partSettingDO.dayTransferBoxVol = p0.progress
|
|
|
+ partSettingDO.nightTransferBoxSystemVol = p0.progress
|
|
|
+ partSettingDO.nightTransferBoxVol = p0.progress
|
|
|
+ }
|
|
|
+ R.id.door_machine_daytime_brightness_seekb -> { //门口机白天亮度
|
|
|
+ SettingConfig.setDoorMachineDaytimeBrightness(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.door_machine_night_brightness_seekb -> { //门口机晚上亮度
|
|
|
+ SettingConfig.setDoorMachineNightBrightness(this.activity,p0.progress)
|
|
|
+ }
|
|
|
+ R.id.door_phone_volume_seekb -> { //门口机通话音量
|
|
|
+ SettingConfig.setDoorPhoneVolume(this.activity,p0.progress)
|
|
|
+ partSettingDO.dayDoorVol = p0.progress
|
|
|
+ partSettingDO.nightDoorVol = p0.progress
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置系统音量
|
|
|
+ */
|
|
|
+ fun setTheSystemVolume(value:Int){
|
|
|
+ //todo 这里需要优化 滑动的时候会调起很多个打开权限的界面
|
|
|
+ if (value <= 15) {
|
|
|
+ val nm = this.activity.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !nm.isNotificationPolicyAccessGranted) {
|
|
|
+// showAlterDialog()
|
|
|
+
|
|
|
+ val intent = Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS)
|
|
|
+ startActivity(intent)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ VoiceManagerUtil.setSystemVoice(this.activity, value)
|
|
|
+ VoiceManagerUtil.setMusicVoice(this.activity, value)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ VoiceManagerUtil.setSystemVoice(this.activity, value)
|
|
|
+ VoiceManagerUtil.setMusicVoice(this.activity, value)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ fun uploadingData(partSettingDO:PartSettingDO){
|
|
|
+// createTime: Int, updateTime: Int, partId: Int, dayStart: String, dayLight: Int,
|
|
|
+// dayVol: Int, dayRingVol: Int, dayRingTimes: Int, dayNurseLed: Int, dayDoorVol: Int,
|
|
|
+// dayBedVol: Int, dayTransferBoxVol: Int, dayTransferBoxSystemVol: Int, nightStart: String,
|
|
|
+// nightLight: Int, nightVol: Int, nightRingVol: Int, nightRingTimes: Int, nightNurseLed: Int,
|
|
|
+// nightDoorVol: Int, nightBedVol: Int, nightTransferBoxVol: Int, nightTransferBoxSystemVol: Int,
|
|
|
+// sleepSecondsNurse: Int, sleepSecondsDoor: Int, sleepSecondsBed: Int, sipOvertime: Int) {
|
|
|
+ if(SettingConfiguration.getInstance().id != null) {
|
|
|
+ partSettingDO.updateTime = System.currentTimeMillis()/1000
|
|
|
+ presenter.setSettingData(
|
|
|
+ partSettingDO.id,
|
|
|
+ partSettingDO.unionId,
|
|
|
+ partSettingDO.createTime.toInt(),
|
|
|
+ partSettingDO.updateTime.toInt(),
|
|
|
+ partSettingDO.partId,
|
|
|
+ partSettingDO.dayStart,
|
|
|
+ partSettingDO.dayLight,
|
|
|
+ partSettingDO.dayVol,
|
|
|
+ partSettingDO.dayRingVol,
|
|
|
+ partSettingDO.dayRingTimes,
|
|
|
+ partSettingDO.dayNurseLed,
|
|
|
+ partSettingDO.dayDoorVol,
|
|
|
+ partSettingDO.dayBedVol,
|
|
|
+ partSettingDO.dayTransferBoxVol,
|
|
|
+ partSettingDO.dayTransferBoxSystemVol,
|
|
|
+ partSettingDO.nightStart,
|
|
|
+ partSettingDO.nightLight,
|
|
|
+ partSettingDO.nightVol,
|
|
|
+ partSettingDO.nightRingVol,
|
|
|
+ partSettingDO.nightRingTimes,
|
|
|
+ partSettingDO.nightNurseLed,
|
|
|
+ partSettingDO.nightDoorVol,
|
|
|
+ partSettingDO.nightBedVol,
|
|
|
+ partSettingDO.nightTransferBoxVol,
|
|
|
+ partSettingDO.nightTransferBoxSystemVol,
|
|
|
+ partSettingDO.sleepSecondsNurse,
|
|
|
+ partSettingDO.sleepSecondsDoor,
|
|
|
+ partSettingDO.sleepSecondsBed,
|
|
|
+ partSettingDO.sipOvertime,
|
|
|
+ partSettingDO.transferDuration,
|
|
|
+ partSettingDO.transferDurationLeader
|
|
|
+ )
|
|
|
+ }else{
|
|
|
+ showMessage("参数设置失败")
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *面销毁回调
|
|
|
+ */
|
|
|
+ override fun destory() {
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun showData(data: PartSettingDO) {
|
|
|
+ showMessage("参数设置成功")
|
|
|
+ (activity as NurseHomeActivity).showHome()
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *处理错误信息
|
|
|
+ */
|
|
|
+ override fun onError(message: String, type: Int) {
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *耗时加载完成
|
|
|
+ */
|
|
|
+ override fun complete(message: String, type: Int) {
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *耗时加载开始
|
|
|
+ */
|
|
|
+ override fun start() {
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *处理网络状态
|
|
|
+ */
|
|
|
+ override fun networkMonitor(state: NetState) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
+ fun onMoonEvent(messageEvent: MessageEvent) {
|
|
|
+// Log.e(TAG,"收到tcp消息")
|
|
|
+// var messageEvent = messageEvent.getMessage() as TcpModel
|
|
|
+// if(messageEvent.getAction() === TcpAction.EventAction.KEY_CLICK){
|
|
|
+//
|
|
|
+// Log.e(TAG,"收到tcp消息"+messageEvent.toJson())
|
|
|
+// }
|
|
|
+ }
|
|
|
+}
|