completed low battery lev urgent call ui.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 14 Sep 2021 07:42:35 +0000 (15:42 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 14 Sep 2021 07:42:35 +0000 (15:42 +0800)
13 files changed:
app/src/main/java/com/ic/view/battery/ChargeTipsView.java [new file with mode: 0644]
app/src/main/res/drawable/selector_urgent_call_bg.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_black_dialog_bg.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_urgent_call_bg_normal.xml [new file with mode: 0644]
app/src/main/res/drawable/shape_urgent_call_bg_press.xml [new file with mode: 0644]
app/src/main/res/layout/battery_charge_tips_dialog_layout.xml [new file with mode: 0644]
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

diff --git a/app/src/main/java/com/ic/view/battery/ChargeTipsView.java b/app/src/main/java/com/ic/view/battery/ChargeTipsView.java
new file mode 100644 (file)
index 0000000..c6bcc7f
--- /dev/null
@@ -0,0 +1,69 @@
+package com.ic.view.battery;
+
+import android.content.Context;
+import android.view.Gravity;
+import android.view.View;
+import android.view.WindowManager;
+
+import com.enqualcomm.support.ICApplication;
+import com.enqualcomm.support.R;
+import com.enqualcomm.support.utils.ICLogger;
+
+/**
+ * 低点请充电提示窗口
+ */
+public class ChargeTipsView {
+
+    private WindowManager windowManager;
+    private View view;
+
+    private ChargeTipsView() {
+        //获取到数据库里的数据,显示快捷回复列表
+    }
+
+    private static ChargeTipsView sInstance;
+
+    public static ChargeTipsView getInstance() {
+        if (sInstance == null) {
+            sInstance = new ChargeTipsView();
+        }
+        return sInstance;
+    }
+
+    private boolean isShow = false;
+
+    public void showMsgDialog() {
+        ICLogger.d("showMsgDialog..." + isShow);
+        if (isShow) {
+            return;
+        }
+        isShow = true;
+        Context context = ICApplication.sContext;
+        windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+        //设置属性
+        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
+        layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
+        //这个是针对S123的屏幕,如果要适配其他,可以动态获取屏幕宽度,高度,再以百分比的形式计算即可。
+        layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
+        layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
+        layoutParams.packageName = context.getPackageName();
+        layoutParams.gravity = Gravity.CENTER;
+        //加载布局
+        view = View.inflate(context, R.layout.msg_dialog_layout, null);
+        //设置适配器
+        initView(view);
+        windowManager.addView(view, layoutParams);
+    }
+
+
+    public void dismiss() {
+        windowManager.removeView(view);
+        sInstance = null;
+        windowManager = null;
+    }
+
+
+    private void initView(final View view) {
+
+    }
+}
diff --git a/app/src/main/res/drawable/selector_urgent_call_bg.xml b/app/src/main/res/drawable/selector_urgent_call_bg.xml
new file mode 100644 (file)
index 0000000..298454a
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@drawable/shape_urgent_call_bg_press" android:state_pressed="true" />
+    <item android:drawable="@drawable/shape_urgent_call_bg_normal" />
+</selector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_black_dialog_bg.xml b/app/src/main/res/drawable/shape_black_dialog_bg.xml
new file mode 100644 (file)
index 0000000..c8e550a
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <solid android:color="#242424" />
+    <corners
+        android:bottomLeftRadius="10dp"
+        android:bottomRightRadius="10dp" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_urgent_call_bg_normal.xml b/app/src/main/res/drawable/shape_urgent_call_bg_normal.xml
new file mode 100644 (file)
index 0000000..a7629a6
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <corners android:radius="4dp" />
+    <solid android:color="#F7392F" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_urgent_call_bg_press.xml b/app/src/main/res/drawable/shape_urgent_call_bg_press.xml
new file mode 100644 (file)
index 0000000..c95f4d1
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+
+    <corners android:radius="4dp" />
+    <solid android:color="#F22117" />
+
+</shape>
\ No newline at end of file
diff --git a/app/src/main/res/layout/battery_charge_tips_dialog_layout.xml b/app/src/main/res/layout/battery_charge_tips_dialog_layout.xml
new file mode 100644 (file)
index 0000000..9094416
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/shape_black_dialog_bg"
+    android:baselineAligned="false"
+    android:gravity="center_horizontal"
+    android:orientation="vertical"
+    android:padding="20dp">
+
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/tips_charge_text"
+        android:textColor="@color/white"
+        android:textSize="20sp" />
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        android:background="@drawable/selector_urgent_call_bg"
+        android:paddingLeft="14dp"
+        android:paddingTop="4dp"
+        android:paddingRight="14dp"
+        android:paddingBottom="4dp"
+        android:text="@string/urgent_call_text"
+        android:textColor="@color/white"
+        android:textSize="16sp" />
+
+
+</LinearLayout>
\ No newline at end of file
index e938d5c..f072f66 100644 (file)
     <string name="alarm_text">闹钟</string>\r
     <string name="out_temp_too_high_text">环境温度过高</string>\r
     <string name="out_temp_too_low_text">环境温度过低</string>\r
+    <string name="tips_charge_text">低电,请充电</string>\r
+    <string name="urgent_call_text">紧急呼救</string>\r
 </resources>\r
index 2593971..4efcfa0 100644 (file)
     <string name="alarm_text">闹钟</string>\r
     <string name="out_temp_too_high_text">环境温度过高</string>\r
     <string name="out_temp_too_low_text">环境温度过低</string>\r
+    <string name="tips_charge_text">低电,请充电</string>\r
+    <string name="urgent_call_text">紧急呼救</string>\r
 </resources>\r
index da03ad4..1fe9f4b 100644 (file)
     <string name="alarm_text">闹钟</string>\r
     <string name="out_temp_too_high_text">环境温度过高</string>\r
     <string name="out_temp_too_low_text">环境温度过低</string>\r
+    <string name="tips_charge_text">低电,请充电</string>\r
+    <string name="urgent_call_text">紧急呼救</string>\r
 </resources>\r
index c8d5a57..2b75cc5 100644 (file)
     <string name="alarm_text">目覚まし时计</string>
     <string name="out_temp_too_high_text">環境温度が高すぎる</string>
     <string name="out_temp_too_low_text">環境温度が低すぎる</string>
+    <string name="tips_charge_text">低电,请充电</string>
+    <string name="urgent_call_text">紧急呼救</string>
 
 </resources>
index c7b437f..c40ed36 100644 (file)
@@ -6,4 +6,6 @@
     <string name="alarm_text">闹钟</string>
     <string name="out_temp_too_high_text">环境温度过高</string>
     <string name="out_temp_too_low_text">环境温度过低</string>
+    <string name="tips_charge_text">低电,请充电</string>
+    <string name="urgent_call_text">紧急呼救</string>
 </resources>
\ No newline at end of file
index 1490bdd..1b23000 100644 (file)
     <string name="alarm_text">闹钟</string>
     <string name="out_temp_too_high_text">环境温度过高</string>
     <string name="out_temp_too_low_text">环境温度过低</string>
+    <string name="tips_charge_text">低电,请充电</string>
+    <string name="urgent_call_text">紧急呼救</string>
 </resources>
index 44c9970..f5a1251 100644 (file)
     <string name="alarm_text">闹钟</string>
     <string name="out_temp_too_high_text">环境温度过高</string>
     <string name="out_temp_too_low_text">环境温度过低</string>
+    <string name="tips_charge_text">低电,请充电</string>
+    <string name="urgent_call_text">紧急呼救</string>
 
 </resources>