add lock of c5
authorTrillGates <williamtrillgates@gmail.com>
Fri, 17 Sep 2021 13:30:39 +0000 (21:30 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Fri, 17 Sep 2021 13:30:39 +0000 (21:30 +0800)
app/release/ICLoopPageLauncher_V43_202109031848_release.apk [deleted file]
app/release/ICLoopPageLauncher_V44_202109172053_release.apk [new file with mode: 0644]
app/release/output-metadata.json
app/src/main/java/com/ic/launcher/presenter/MainPagePresenter.java
app/src/main/java/com/ic/launcher/presenter/StatusBarBasePresenter.java
app/src/main/java/com/ic/launcher/utils/IConState.java [new file with mode: 0644]
app/src/main/java/com/ic/launcher/view/StatusBarView.java
app/src/main/res/layout/item_status_bar.xml
app/src/main/res/mipmap-mdpi/lock.png [new file with mode: 0644]
app/src/main/res/mipmap-mdpi/unlock.png [new file with mode: 0644]
app/version_code.properties

diff --git a/app/release/ICLoopPageLauncher_V43_202109031848_release.apk b/app/release/ICLoopPageLauncher_V43_202109031848_release.apk
deleted file mode 100644 (file)
index 3bff552..0000000
Binary files a/app/release/ICLoopPageLauncher_V43_202109031848_release.apk and /dev/null differ
diff --git a/app/release/ICLoopPageLauncher_V44_202109172053_release.apk b/app/release/ICLoopPageLauncher_V44_202109172053_release.apk
new file mode 100644 (file)
index 0000000..733a6f8
Binary files /dev/null and b/app/release/ICLoopPageLauncher_V44_202109172053_release.apk differ
index f8c9f86..14a6577 100644 (file)
@@ -12,7 +12,7 @@
       "filters": [],
       "versionCode": 1,
       "versionName": "1.0",
-      "outputFile": "ICLoopPageLauncher_V43_202109031848_release.apk"
+      "outputFile": "ICLoopPageLauncher_V44_202109172053_release.apk"
     }
   ]
 }
\ No newline at end of file
index 2f548c3..f7dc507 100644 (file)
@@ -79,7 +79,7 @@ public class MainPagePresenter extends BasePresenter {
     }
 
     private void getStepCount() {
-        getValue(KEY_STEP_COUNT);
+        getValueByKey(KEY_STEP_COUNT);
     }
 
     private final BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
@@ -332,6 +332,9 @@ public class MainPagePresenter extends BasePresenter {
             case KEY_TEMP:
                 bodyTempValue.postValue(value);
                 break;
+            case KEY_STEP_COUNT:
+                stepCountValue.postValue(value);
+                break;
         }
     }
 
index a047db7..c0ba1dc 100644 (file)
@@ -17,6 +17,7 @@ import android.telephony.TelephonyManager;
 import androidx.lifecycle.MutableLiveData;
 
 import com.ic.iclooger.ICLogger;
+import com.ic.launcher.utils.IConState;
 import com.ic.launcher.utils.SoundPlayUtils;
 import com.ic.launcher.utils.SystemUtils;
 import com.ic.launcher.utils.VibrateUtil;
@@ -40,9 +41,9 @@ public class StatusBarBasePresenter extends BasePresenter {
     //网络类型
     public MutableLiveData<String> networkTypeValue = new MutableLiveData<>();
     //未佩戴状态
-    public MutableLiveData<Boolean> wearStateValue = new MutableLiveData<>();
+    public MutableLiveData<IConState> wearStateValue = new MutableLiveData<>();
     //剪断状态
-    public MutableLiveData<Boolean> cutStateValue = new MutableLiveData<>();
+    public MutableLiveData<IConState> cutStateValue = new MutableLiveData<>();
 
     private Handler handler;
     private TelephonyManager mTelephony;
@@ -152,23 +153,27 @@ public class StatusBarBasePresenter extends BasePresenter {
 
     private void getWearState() {
         String isAntiOff = SystemUtils.getSystemPropertiesString("persist.sys.ic_antioff", "");
-        ICLogger.d("isAntiOff ==> " + isAntiOff);
+        //ICLogger.d("isAntiOff ==> " + isAntiOff);
         if ("true".equals(isAntiOff)) {
             //未佩戴
-            wearStateValue.postValue(Boolean.FALSE);
+            wearStateValue.postValue(IConState.TRUE);
+        } else if ("false".equals(isAntiOff)) {
+            wearStateValue.postValue(IConState.FALSE);
         } else {
-            wearStateValue.postValue(Boolean.TRUE);
+            wearStateValue.postValue(IConState.NONE);
         }
     }
 
     private void getCutState() {
-        String isAntiOff = SystemUtils.getSystemPropertiesString("persist.sys.ic_cutoff", "");
-        ICLogger.d("isAntiOff ==> " + isAntiOff);
-        if ("true".equals(isAntiOff)) {
+        String isCutOff = SystemUtils.getSystemPropertiesString("persist.sys.ic_cutoff", "");
+        //ICLogger.d("isAntiOff ==> " + isCutOff);
+        if ("true".equals(isCutOff)) {
             //剪断了
-            cutStateValue.postValue(Boolean.TRUE);
+            cutStateValue.postValue(IConState.TRUE);
+        } else if ("false".equals(isCutOff)) {
+            cutStateValue.postValue(IConState.FALSE);
         } else {
-            cutStateValue.postValue(Boolean.FALSE);
+            cutStateValue.postValue(IConState.NONE);
         }
     }
 
diff --git a/app/src/main/java/com/ic/launcher/utils/IConState.java b/app/src/main/java/com/ic/launcher/utils/IConState.java
new file mode 100644 (file)
index 0000000..7fba63c
--- /dev/null
@@ -0,0 +1,5 @@
+package com.ic.launcher.utils;
+
+public enum IConState {
+    NONE, TRUE, FALSE
+}
index a777380..098db35 100644 (file)
@@ -5,6 +5,7 @@ import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.FrameLayout;
+import android.widget.ImageView;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
@@ -14,6 +15,7 @@ import androidx.lifecycle.LifecycleOwner;
 import com.ic.iclooger.ICLogger;
 import com.ic.launcher.R;
 import com.ic.launcher.presenter.StatusBarPresenter;
+import com.ic.launcher.utils.IConState;
 
 
 public class StatusBarView extends FrameLayout {
@@ -35,6 +37,7 @@ public class StatusBarView extends FrameLayout {
     private View silentIconView;
     private View shakeView;
     private View planeModeView;
+    private ImageView cuntStateView;
 
     public StatusBarView(@NonNull Context context) {
         this(context, null);
@@ -63,6 +66,7 @@ public class StatusBarView extends FrameLayout {
         alarmView = findViewById(R.id.top_icon_alarm);
         newMsgView = findViewById(R.id.top_icon_new_msg);
         wearView = findViewById(R.id.top_icon_wear);
+        cuntStateView = findViewById(R.id.top_icon_lock);
         phoneView = findViewById(R.id.top_icon_phone);
         icTalkView = findViewById(R.id.top_icon_ic_talk);
         silentIconView = findViewById(R.id.top_icon_silent);
@@ -104,12 +108,22 @@ public class StatusBarView extends FrameLayout {
             phoneView.setVisibility(hasMiss == Boolean.TRUE ? VISIBLE : GONE);
         });
         statusBarPresenter.wearStateValue.observe(lifecycleOwner, hasWear -> {
-            //是否有穿戴
-            wearView.setVisibility(hasWear == Boolean.TRUE ? GONE : VISIBLE);
+            if (hasWear == IConState.TRUE || hasWear == IConState.NONE) {
+                //没有佩戴
+                wearView.setVisibility(GONE);
+            } else {
+                wearView.setVisibility(VISIBLE);
+            }
+
         });
         statusBarPresenter.cutStateValue.observe(lifecycleOwner, hasWear -> {
             //是否剪断,如果没有剪断,则会显示图标,如果剪断了,那么就没有图标了
-            wearView.setVisibility(hasWear == Boolean.TRUE ? VISIBLE : GONE);
+            if (hasWear == IConState.NONE) {
+                cuntStateView.setVisibility(GONE);
+            } else {
+                cuntStateView.setVisibility(VISIBLE);
+                cuntStateView.setImageResource(hasWear == IConState.TRUE ? R.mipmap.unlock : R.mipmap.lock);
+            }
         });
         statusBarPresenter.msgUnReadState.observe(lifecycleOwner, hasRead -> {
             //消息是否有读
index 7510ee0..985cb30 100644 (file)
             android:visibility="gone" />
 
 
+        <ImageView
+            android:id="@+id/top_icon_lock"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@mipmap/lock"
+            android:visibility="gone" />
+
+
         <ImageView
             android:id="@+id/top_icon_wear"
             android:layout_width="wrap_content"
diff --git a/app/src/main/res/mipmap-mdpi/lock.png b/app/src/main/res/mipmap-mdpi/lock.png
new file mode 100644 (file)
index 0000000..0151f36
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/lock.png differ
diff --git a/app/src/main/res/mipmap-mdpi/unlock.png b/app/src/main/res/mipmap-mdpi/unlock.png
new file mode 100644 (file)
index 0000000..1316938
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/unlock.png differ
index d32fb5b..b6277da 100644 (file)
@@ -1,2 +1,2 @@
-#Fri Sep 03 18:48:57 CST 2021
-VERSION_CODE=43
+#Fri Sep 17 21:30:21 CST 2021
+VERSION_CODE=45