瀏覽代碼

分机多功能按钮配置优化和提醒优化

wzl 2 月之前
父節點
當前提交
11b36ef6e5

+ 25 - 5
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt

@@ -43,6 +43,7 @@ import com.wdkl.app.ncs.callingbed.bt_gateway.*
 import com.wdkl.app.ncs.callingbed.databinding.CallingbedMainNewBinding
 import com.wdkl.app.ncs.callingbed.dialog.CallTypeDialogHelper
 import com.wdkl.app.ncs.callingbed.dialog.Device433DialogHelper
+import com.wdkl.app.ncs.callingbed.dialog.LoadingDialogHelper
 import com.wdkl.app.ncs.callingbed.dialog.ReinforcementsDialogHelper
 import com.wdkl.app.ncs.callingbed.fragment.*
 import com.wdkl.app.ncs.callingbed.hardware.HardWareFactory
@@ -1494,7 +1495,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
             if (time - clickCallTime > 2500) {
                 clickCallTime = time
 
-                if ( Constant.NursingTitle .equals(getString(R.string.enter_nursing))){
+                if (Constant.NursingTitle .equals(getString(R.string.enter_nursing))){
                     if (Constant.CALL_STATE == Constant.CALL_CALLING) {
                         //通话中挂断
                         EventBus.getDefault().post(MessageEvent("handoff", Constant.EVENT_SERIAL_EVENT))
@@ -1578,6 +1579,7 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
      */
     fun setButtonType(status: String?) {
         if (Constant.device_button_function.isNullOrEmpty()) {
+            Log.e(TAG, "没有配置按键功能,使用默认")
             if (status == "5" || status == "6") {
                 //手柄呼叫键,面板呼叫键
                 val time = System.currentTimeMillis()
@@ -1689,10 +1691,19 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                         EventBus.getDefault().post(MessageEvent("reject", Constant.EVENT_SERIAL_EVENT))
                     }
                 } else {
-                    when {
-                        TextUtils.isEmpty(Constant.SIP_ID) -> showMessage(R.string.no_custom)
-                        Constant.CALL_STATE == Constant.CALL_STANDBY -> startCallRoleName(value.toString())
-                        else -> showMessage(R.string.call_fail)
+                    if (Constant.CALL_STATE == Constant.CALL_STANDBY) {
+                        //发起呼叫
+                        if (!TextUtils.isEmpty(Constant.SIP_ID)) {
+                            startCallRoleName(value.toString())
+                        } else {
+                            showMessage(R.string.no_custom)
+                        }
+                    } else if (Constant.CALL_STATE == Constant.CALL_INCOMING) {
+                        //来电接听
+                        EventBus.getDefault().post(MessageEvent("accept", Constant.EVENT_SERIAL_EVENT))
+                    } else if (Constant.CALL_STATE == Constant.CALL_CALLING) {
+                        //通话中挂断
+                        EventBus.getDefault().post(MessageEvent("handoff", Constant.EVENT_SERIAL_EVENT))
                     }
                 }
             } else {
@@ -1711,6 +1722,15 @@ class CallingbedActivity :BaseActivity<BedCallingbedActivityPresenter, Callingbe
                     val eventValue = value as Double?
                     val tcpModel = EventUtil.eventKeyClick(Constant.DEVICE_ID, eventValue?.toInt())
                     TcpClient.getInstance().sendMsg(tcpModel.toJson())
+
+                    runOnUiThread {
+                        if (BuildConfig.device_type.equals("1")){
+                            LoadingDialogHelper.showLoadingDialog(activity)
+                        }else {
+                            ReinforcementsDialogHelper.showDialog(activity, 1)
+                        }
+                        SoundPoolManager.getInstance().playSound(4, 1.0f, 1.0f, 0)
+                    }
                 } catch (e: Exception) {
                     e.printStackTrace()
                 }

+ 2 - 4
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/dialog/LoadingDialogHelper.java

@@ -19,10 +19,8 @@ public class LoadingDialogHelper {
     private static AlertDialog dialog;
 
     public static void showLoadingDialog(final Activity activity) {
-
-
-        if (dialog != null && dialog.isShowing()) {
-            return;
+        if (dialog != null) {
+            dialog.dismiss();
         }
         // 倒计时时间(单位:毫秒)
         long countdownTime = 3000;

+ 3 - 2
android_bed/src/main/java/com/wdkl/app/ncs/callingbed/dialog/ReinforcementsDialogHelper.java

@@ -30,8 +30,8 @@ public class ReinforcementsDialogHelper {
         }
     }
     public static void showDialog(Activity activity ,int type) {
-        if (alertDialog != null && alertDialog.isShowing()) {
-            return;
+        if (alertDialog != null) {
+            alertDialog.dismiss();
         }
         // 倒计时时间(单位:毫秒)
         long countdownTime = 5000;
@@ -45,6 +45,7 @@ public class ReinforcementsDialogHelper {
                 }
             }
         };
+
         View contentView = LayoutInflater.from(activity).inflate(R.layout.main_reinforcements_dialog, null);
         AlertDialog.Builder builder = new AlertDialog.Builder(activity);
         builder.setView(contentView);