فهرست منبع

<7寸分机不带护理灯,但护理项颜色需要对应显示>

weizhengliang 5 سال پیش
والد
کامیت
f72e9960ed

+ 5 - 5
app/src/main/java/com/wdkl/callingbed2/entity/MainDataEntity.java

@@ -101,7 +101,7 @@ public class MainDataEntity {
     }
 
     public String getLeftOneColor() {
-        return leftOneColor == null ? "000000" : leftOneColor;
+        return leftOneColor == null ? "B8B8B8" : leftOneColor;
     }
 
     public void setLeftTwoColor(String leftTwoColor) {
@@ -109,7 +109,7 @@ public class MainDataEntity {
     }
 
     public String getLeftTwoColor() {
-        return leftTwoColor == null ? "000000" : leftTwoColor;
+        return leftTwoColor == null ? "B8B8B8" : leftTwoColor;
     }
 
     public void setLeftThreeColor(String leftThreeColor) {
@@ -117,7 +117,7 @@ public class MainDataEntity {
     }
 
     public String getLeftThreeColor() {
-        return leftThreeColor == null ? "000000" : leftThreeColor;
+        return leftThreeColor == null ? "B8B8B8" : leftThreeColor;
     }
 
     public void setLeftFourColor(String leftFourColor) {
@@ -125,7 +125,7 @@ public class MainDataEntity {
     }
 
     public String getLeftFourColor() {
-        return leftFourColor == null ? "000000" : leftFourColor;
+        return leftFourColor == null ? "B8B8B8" : leftFourColor;
     }
 
     public void setLeftFiveColor(String leftFiveColor) {
@@ -133,7 +133,7 @@ public class MainDataEntity {
     }
 
     public String getLeftFiveColor() {
-        return leftFiveColor == null ? "000000" : leftFiveColor;
+        return leftFiveColor == null ? "B8B8B8" : leftFiveColor;
     }
 
     public void setLeftOneContent(String leftOneContent) {

+ 47 - 5
app/src/main/java/com/wdkl/callingbed2/ui/CallingBedActivity.java

@@ -12,6 +12,7 @@ import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.net.wifi.WifiManager;
@@ -268,22 +269,32 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
 
     /*主界面id*/
     //左侧护理项
+    @Bind(R.id.view_main_layout_left_one)
+    LinearLayout llViewLeftOne;
     @Bind(R.id.view_main_layout_left_one_title)
     TextView tvLeftOneTitle;
     @Bind(R.id.view_main_layout_left_one_content)
     TextView tvLeftOneContent;
+    @Bind(R.id.view_main_layout_left_two)
+    LinearLayout llViewLeftTwo;
     @Bind(R.id.view_main_layout_left_two_title)
     TextView tvLeftTwoTitle;
     @Bind(R.id.view_main_layout_left_two_content)
     TextView tvLeftTwoContent;
+    @Bind(R.id.view_main_layout_left_three)
+    LinearLayout llViewLeftThree;
     @Bind(R.id.view_main_layout_left_three_title)
     TextView tvLeftThreeTitle;
     @Bind(R.id.view_main_layout_left_three_content)
     TextView tvLeftThreeContent;
+    @Bind(R.id.view_main_layout_left_four)
+    LinearLayout llViewLeftFour;
     @Bind(R.id.view_main_layout_left_four_title)
     TextView tvLeftFourTitle;
     @Bind(R.id.view_main_layout_left_four_content)
     TextView tvLeftFourContent;
+    @Bind(R.id.view_main_layout_left_five)
+    LinearLayout llViewLeftFive;
     @Bind(R.id.view_main_layout_left_five_title)
     TextView tvLeftFiveTitle;
     @Bind(R.id.view_main_layout_left_five_content)
@@ -1893,8 +1904,9 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
         if (StringUtils.isInt(Constants.SYSVOICE)) {
             setSYSVoice(CallingBedActivity.this, StringUtils.parseInt(Constants.SYSVOICE));
         }
-        if (StringUtils.isInt(Constants.NURSINGLIGHT) && null != mainDataEntity) {
-            new Thread(new Runnable() {
+        if (/*StringUtils.isInt(Constants.NURSINGLIGHT) && */null != mainDataEntity) {
+            //7寸分机不带护理灯
+            /*new Thread(new Runnable() {
                 @Override
                 public void run() {
                     try {
@@ -1906,13 +1918,42 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                         e.printStackTrace();
                     }
                 }
-            }).start();
+            }).start();*/
+            updateNursingBackground();
         }
         VoiceManagerUtil.setCallVoice(CallingBedActivity.this, Integer.parseInt(Constants.BEDCALLVOICE));
         //刷新呼叫超时时间
         callTimeOut = (StringUtils.parseInt(Constants.CALLINGTIMEOUT) == 0 ? 180000 : StringUtils.parseInt(Constants.CALLINGTIMEOUT) * 1000);
     }
 
+    private void updateNursingBackground() {
+        //LogUtil.d("NURSELIGHT", "设置护理灯" + Constants.NURSINGLIGHT + "---" + mainDataEntity.getLeftOneColor() + "---" + mainDataEntity.getLeftTwoColor() + "---" + mainDataEntity.getLeftThreeColor() + "---" + mainDataEntity.getLeftFourColor() + "---" + mainDataEntity.getLeftFiveColor());
+        try {
+            int color = Color.parseColor("#" + mainDataEntity.getLeftOneColor());
+            GradientDrawable drawable1 = (GradientDrawable) llViewLeftOne.getBackground();
+            drawable1.setColor(color);
+
+            color = Color.parseColor("#" + mainDataEntity.getLeftTwoColor());
+            GradientDrawable drawable2 = (GradientDrawable) llViewLeftTwo.getBackground();
+            drawable2.setColor(color);
+
+            color = Color.parseColor("#" + mainDataEntity.getLeftThreeColor());
+            GradientDrawable drawable3 = (GradientDrawable) llViewLeftThree.getBackground();
+            drawable3.setColor(color);
+
+            color = Color.parseColor("#" + mainDataEntity.getLeftFourColor());
+            GradientDrawable drawable4 = (GradientDrawable) llViewLeftFour.getBackground();
+            drawable4.setColor(color);
+
+            color = Color.parseColor("#" + mainDataEntity.getLeftFiveColor());
+            GradientDrawable drawable5 = (GradientDrawable) llViewLeftFive.getBackground();
+            drawable5.setColor(color);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
     //---------------------------------------------设置硬件参数部分(下)-----------------------------------------------------------------
     //---------------------------------------------串口点击事件部分(上)---------------------------------------------------------------------
     //主页面
@@ -2217,7 +2258,8 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
      * 灭掉护理灯
      */
     public void dismissNurseBrightness() {
-        new Thread(new Runnable() {
+        //7寸分机不带护理灯
+        /*new Thread(new Runnable() {
             @Override
             public void run() {
                 try {
@@ -2226,7 +2268,7 @@ public class CallingBedActivity extends BaseActivity implements ISerialPortBedOn
                     e.printStackTrace();
                 }
             }
-        }).start();
+        }).start();*/
     }
 
     @Override

+ 5 - 0
app/src/main/res/drawable/shape_left_item_default_bg.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#B8B8B8"/>
+    <corners android:radius="10dp"/>
+</shape>

+ 10 - 5
app/src/main/res/layout/view_main_layout2.xml

@@ -13,9 +13,10 @@
         android:orientation="vertical">
 
         <LinearLayout
+            android:id="@+id/view_main_layout_left_one"
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:background="@drawable/shape_left_one_bg"
+            android:background="@drawable/shape_left_item_default_bg"
             android:gravity="center_vertical"
             android:orientation="horizontal"
             android:layout_weight="1">
@@ -41,10 +42,11 @@
         </LinearLayout>
 
         <LinearLayout
+            android:id="@+id/view_main_layout_left_two"
             android:layout_width="match_parent"
             android:layout_height="0dp"
             android:layout_marginTop="10dp"
-            android:background="@drawable/shape_left_two_bg"
+            android:background="@drawable/shape_left_item_default_bg"
             android:gravity="center_vertical"
             android:orientation="horizontal"
             android:layout_weight="1">
@@ -69,10 +71,11 @@
         </LinearLayout>
 
         <LinearLayout
+            android:id="@+id/view_main_layout_left_three"
             android:layout_width="match_parent"
             android:layout_height="0dp"
             android:layout_marginTop="10dp"
-            android:background="@drawable/shape_left_three_bg"
+            android:background="@drawable/shape_left_item_default_bg"
             android:gravity="center_vertical"
             android:orientation="horizontal"
             android:layout_weight="1">
@@ -97,10 +100,11 @@
         </LinearLayout>
 
         <LinearLayout
+            android:id="@+id/view_main_layout_left_four"
             android:layout_width="match_parent"
             android:layout_height="0dp"
             android:layout_marginTop="10dp"
-            android:background="@drawable/shape_left_four_bg"
+            android:background="@drawable/shape_left_item_default_bg"
             android:gravity="center_vertical"
             android:orientation="horizontal"
             android:layout_weight="1">
@@ -125,10 +129,11 @@
         </LinearLayout>
 
         <LinearLayout
+            android:id="@+id/view_main_layout_left_five"
             android:layout_width="match_parent"
             android:layout_height="0dp"
             android:layout_marginTop="10dp"
-            android:background="@drawable/shape_left_five_bg"
+            android:background="@drawable/shape_left_item_default_bg"
             android:gravity="center_vertical"
             android:orientation="horizontal"
             android:layout_weight="1">