From: TrillGates Date: Fri, 17 Sep 2021 13:30:39 +0000 (+0800) Subject: add lock of c5 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=31213ace56da1db88b4d95e49917eec7ed12f723;p=iclooplauncher.git add lock of c5 --- diff --git a/app/release/ICLoopPageLauncher_V43_202109031848_release.apk b/app/release/ICLoopPageLauncher_V43_202109031848_release.apk deleted file mode 100644 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 index 0000000..733a6f8 Binary files /dev/null and b/app/release/ICLoopPageLauncher_V44_202109172053_release.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index f8c9f86..14a6577 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -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 diff --git a/app/src/main/java/com/ic/launcher/presenter/MainPagePresenter.java b/app/src/main/java/com/ic/launcher/presenter/MainPagePresenter.java index 2f548c3..f7dc507 100644 --- a/app/src/main/java/com/ic/launcher/presenter/MainPagePresenter.java +++ b/app/src/main/java/com/ic/launcher/presenter/MainPagePresenter.java @@ -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; } } diff --git a/app/src/main/java/com/ic/launcher/presenter/StatusBarBasePresenter.java b/app/src/main/java/com/ic/launcher/presenter/StatusBarBasePresenter.java index a047db7..c0ba1dc 100644 --- a/app/src/main/java/com/ic/launcher/presenter/StatusBarBasePresenter.java +++ b/app/src/main/java/com/ic/launcher/presenter/StatusBarBasePresenter.java @@ -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 networkTypeValue = new MutableLiveData<>(); //未佩戴状态 - public MutableLiveData wearStateValue = new MutableLiveData<>(); + public MutableLiveData wearStateValue = new MutableLiveData<>(); //剪断状态 - public MutableLiveData cutStateValue = new MutableLiveData<>(); + public MutableLiveData 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 index 0000000..7fba63c --- /dev/null +++ b/app/src/main/java/com/ic/launcher/utils/IConState.java @@ -0,0 +1,5 @@ +package com.ic.launcher.utils; + +public enum IConState { + NONE, TRUE, FALSE +} diff --git a/app/src/main/java/com/ic/launcher/view/StatusBarView.java b/app/src/main/java/com/ic/launcher/view/StatusBarView.java index a777380..098db35 100644 --- a/app/src/main/java/com/ic/launcher/view/StatusBarView.java +++ b/app/src/main/java/com/ic/launcher/view/StatusBarView.java @@ -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 -> { //消息是否有读 diff --git a/app/src/main/res/layout/item_status_bar.xml b/app/src/main/res/layout/item_status_bar.xml index 7510ee0..985cb30 100644 --- a/app/src/main/res/layout/item_status_bar.xml +++ b/app/src/main/res/layout/item_status_bar.xml @@ -63,6 +63,14 @@ android:visibility="gone" /> + + +