fixed sms dialog top title text.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 28 Sep 2021 06:22:14 +0000 (14:22 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 28 Sep 2021 06:22:14 +0000 (14:22 +0800)
13 files changed:
app/src/main/java/com/enqualcomm/support/ICSmsManager.java
app/src/main/java/com/ic/protocols/protocol_ic.java
app/src/main/java/com/ic/view/msg/MessageAdapter.java
app/src/main/java/com/ic/view/msg/MsgMustReadDialog.java
app/src/main/res/layout/activity_tool.xml
app/src/main/res/layout/msg_item_layout.xml
app/src/main/res/values-de-rCH/strings.xml
app/src/main/res/values-fr-rCH/strings.xml
app/src/main/res/values-it-rCH/strings.xml
app/src/main/res/values-ja/strings.xml
app/src/main/res/values-w820dp/strings.xml
app/src/main/res/values-zh-rCN/strings.xml
app/src/main/res/values/strings.xml

index ab25f26..6c05c56 100644 (file)
@@ -111,7 +111,6 @@ public class ICSmsManager extends BroadcastReceiver {
             ICSmsManager.preTimeMillis = currenttime;
             SystemClock.sleep(3000L);
             if (intent == null || intent.getAction() == null) return;
-
             //长短信会被分拆送来,因此可能会有多个PDU。Protocol Description Unit是短信的工业标准。 
             Object[] pduArray = (Object[]) intent.getExtras().get("pdus");
             ICLogger.i("pdu number=" + pduArray.length);
@@ -146,7 +145,7 @@ public class ICSmsManager extends BroadcastReceiver {
                     } else {
                         //其他的照样弹窗
                         //add by TrillGates=======end
-                        MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
+                        MsgMustReadDialog instance = MsgMustReadDialog.getInstance(MsgMustReadDialog.TYPE_MSG_DIALOG);
                         instance.showMsgDialog();
                         List<String> list = new ArrayList<>();
                         list.add(message);
@@ -269,7 +268,7 @@ public class ICSmsManager extends BroadcastReceiver {
                                         VibrateUtil.getInstance(mContext).VibrateOnOnce(true);
                                         Util.mSleep(2000);
 
-                                        MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
+                                        MsgMustReadDialog instance = MsgMustReadDialog.getInstance(MsgMustReadDialog.TYPE_MSG_DIALOG);
                                         instance.showMsgDialog();
                                         List<String> list = new ArrayList<>();
                                         list.add(smsmessage);
index 203231e..08ae237 100644 (file)
@@ -1327,7 +1327,7 @@ public class protocol_ic {
                 String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg");
                 ICLogger.d("forceReadMsg == > " + forceReadMsg);
                 if (!TextUtils.isEmpty(forceReadMsg)) {
-                    MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
+                    MsgMustReadDialog instance = MsgMustReadDialog.getInstance(MsgMustReadDialog.TYPE_WEB_MSG_DIALOG);
                     instance.showMsgDialog();
                     List<String> list = new ArrayList<>();
                     list.add(txtmsg);
@@ -2215,7 +2215,7 @@ public class protocol_ic {
                 if (Integer.parseInt(switch_on) == 1) {
                     ICLogger.i("Handle BPDG index " + index + ", 体温报警阈值开 min=" + min_temp + ",max=" + max_temp);
                     runtime.tempInfo.setBodyTempThreshold(Double.valueOf(max_temp),
-                            Double.valueOf(min_temp),-1,-1);
+                            Double.valueOf(min_temp), -1, -1);
                     Config.needTemperature_abnormal_alarm = true;
                 } else {
                     ICLogger.i("Handle BPDG index " + index + ", 体温报警阈值关 ");
index 7d97237..64439c1 100644 (file)
@@ -11,10 +11,13 @@ import com.enqualcomm.support.utils.ICLogger;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.ic.view.msg.MsgMustReadDialog.TYPE_MSG_DIALOG;
+
 public class MessageAdapter extends PagerAdapter {
 
 
     private final List<String> msgData = new ArrayList<>();
+    private int mType;
 
     @Override
     public Object instantiateItem(ViewGroup container, int position) {
@@ -31,6 +34,15 @@ public class MessageAdapter extends PagerAdapter {
             });
         } else {
             item = View.inflate(container.getContext(), R.layout.msg_item_layout, null);
+            TextView titleView = (TextView) item.findViewById(R.id.msg_title_tv);
+            //根据类型显示标题
+            if (mType == TYPE_MSG_DIALOG) {
+                //短信
+                titleView.setText(R.string.sms_title_text);
+            } else {
+                //Web短信
+                titleView.setText(R.string.web_sms_title_text);
+            }
             //设置数据
             TextView msgView = (TextView) item.findViewById(R.id.msg_text_tv);
             //如果只有一条消息,就显示为关闭,否则显示下一条
@@ -96,6 +108,10 @@ public class MessageAdapter extends PagerAdapter {
         this.mListener = listener;
     }
 
+    public void setType(int type) {
+        this.mType = type;
+    }
+
     public interface OnClickListener {
 
         void onNextClick();
index ba1feb1..9b0ca09 100644 (file)
@@ -20,19 +20,22 @@ import java.util.List;
  */
 public class MsgMustReadDialog {
 
+    public static final int TYPE_MSG_DIALOG = 0;
+    public static final int TYPE_WEB_MSG_DIALOG = 1;
+    private int mType = TYPE_MSG_DIALOG;
     private WindowManager windowManager;
     private MessageAdapter messageAdapter;
     private ViewPager msgPage;
 
-    private MsgMustReadDialog() {
-
+    private MsgMustReadDialog(int type) {
+        this.mType = type;
     }
 
     private static MsgMustReadDialog sInstance;
 
-    public static MsgMustReadDialog getInstance() {
+    public static MsgMustReadDialog getInstance(int type) {
         if (sInstance == null) {
-            sInstance = new MsgMustReadDialog();
+            sInstance = new MsgMustReadDialog(type);
         }
         return sInstance;
     }
@@ -80,6 +83,7 @@ public class MsgMustReadDialog {
         msgPage.setOffscreenPageLimit(pageLimit);
         //设置适配器
         messageAdapter = new MessageAdapter();
+        messageAdapter.setType(mType);
         msgPage.setAdapter(messageAdapter);
         messageAdapter.setOnClickListener(new MessageAdapter.OnClickListener() {
             @Override
@@ -89,6 +93,7 @@ public class MsgMustReadDialog {
                 currentItem++;
                 msgPage.setCurrentItem(currentItem, false);
             }
+
             @Override
             public void onEndClick() {
                 windowManager.removeView(view);
index a91af8c..cfdc861 100644 (file)
@@ -68,6 +68,7 @@
             android:text="模式1"\r
             android:textSize="18sp" />\r
     </LinearLayout>\r
+\r
     <LinearLayout\r
         android:layout_width="match_parent"\r
         android:layout_height="wrap_content"\r
@@ -98,4 +99,5 @@
             android:text="运动检测"\r
             android:textSize="18sp" />\r
     </LinearLayout>\r
+\r
 </LinearLayout>
\ No newline at end of file
index 0346e26..9319bc2 100644 (file)
@@ -11,6 +11,7 @@
         android:background="#117CFD"
         android:gravity="center_horizontal"
         android:paddingTop="10dp"
+        android:id="@+id/msg_title_tv"
         android:paddingBottom="10dp"
         android:text="@string/web_sms_title_text"
         android:textColor="@android:color/black"
index 6cdb52c..7425575 100644 (file)
     <string name="urgent_call_text">紧急呼救</string>\r
     <string name="battery_to_low">电量过低</string>\r
     <string name="device_shutdown_tips_text">设备随时关机</string>\r
+    <string name="sms_title_text">短信</string>\r
 </resources>\r
index c8957bc..b301e77 100644 (file)
     <string name="urgent_call_text">紧急呼救</string>\r
     <string name="battery_to_low">电量过低</string>\r
     <string name="device_shutdown_tips_text">设备随时关机</string>\r
+    <string name="sms_title_text">短信</string>\r
 </resources>\r
index 7d26e5b..dbe73c4 100644 (file)
     <string name="urgent_call_text">紧急呼救</string>\r
     <string name="battery_to_low">电量过低</string>\r
     <string name="device_shutdown_tips_text">设备随时关机</string>\r
+    <string name="sms_title_text">短信</string>\r
 </resources>\r
index 323fbf2..4ba7258 100644 (file)
     <string name="urgent_call_text">紧急呼救</string>
     <string name="battery_to_low">电量过低</string>
     <string name="device_shutdown_tips_text">设备随时关机</string>
+    <string name="sms_title_text">短信</string>
 
 </resources>
index d9bd37b..af6d70f 100644 (file)
@@ -10,4 +10,5 @@
     <string name="urgent_call_text">紧急呼救</string>
     <string name="battery_to_low">电量过低</string>
     <string name="device_shutdown_tips_text">设备随时关机</string>
+    <string name="sms_title_text">短信</string>
 </resources>
\ No newline at end of file
index 6ee98ff..bbf761f 100644 (file)
     <string name="urgent_call_text">紧急呼救</string>
     <string name="battery_to_low">电量过低</string>
     <string name="device_shutdown_tips_text">设备随时关机</string>
+    <string name="sms_title_text">短信</string>
 </resources>
index 977fd69..aecaad1 100644 (file)
     <string name="urgent_call_text">紧急呼救</string>
     <string name="battery_to_low">电量过低</string>
     <string name="device_shutdown_tips_text">设备随时关机,请及时充电</string>
+    <string name="sms_title_text">短信</string>
 
 </resources>