"type": "SINGLE",
"filters": [],
"properties": [],
- "versionCode": 181,
- "versionName": "202011271628",
+ "versionCode": 182,
+ "versionName": "202011272041",
"enabled": true,
- "outputFile": "ICL02Launcher_V181_202011271628_release.apk"
+ "outputFile": "ICL02Launcher_V182_202011272041_release.apk"
}
]
}
\ No newline at end of file
bindWorkService(this);
} else {
//给出UI提示
- Toast.makeText(this, getString(R.string.no_wearing_device_tips_text),
- Toast.LENGTH_SHORT).show();
+ heatBinding.setCheckTips(getString(R.string.no_wearing_device_tips_text));
}
//initWakeLock(this);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- heatBinding.setBodyTemp("--");
- heatBinding.setWristTemp("--");
+ heatBinding.setBodyTemp("--.-");
+ heatBinding.setWristTemp("--.-");
+ heatBinding.setTempout("--.-");
boolean disablewristtemp = SystemUtils.getSystemPropertiesBoolean("persyst.sys.disableWristTemp", false);
boolean disabletempOUt = SystemUtils.getSystemPropertiesBoolean("persyst.sys.disableTempOut", true);
heatBinding.setDisableWristTemp(disablewristtemp);
try {
mService.onStopQueryTemp();
} catch (Exception e) {
- IcLog.i("Temperature", e.getMessage());
+ e.printStackTrace();
+ //e.getMessage may be null.
+ //IcLog.i("Temperature", e.getMessage());
}
// releaseWakeLock();
- unbindWorkService(this);
+ if (mService != null) {
+ unbindWorkService(this);
+ }
unregisterReceiver(mIntentReceiver);
unregisterReceiver(mAntiStateReceiver);
}
return true;
}
+ private int currentTestType = -1;
+
private void setTemperatureUi(int type, double temp, double animal, double tempOut) {
+ IcLog.i(TAG, "type -- > " + type);
+ IcLog.i(TAG, "temp -- > " + temp);
+ IcLog.i(TAG, "animal -- > " + animal);
+ IcLog.i(TAG, "tempOut -- > " + tempOut);
+ //这里有个瞬间过大的bug,人腕温不可能大于45度的。
+ if (temp > 45) {
+ temp = 45.0d;
+ }
+ currentTestType = type;
DecimalFormat df = new DecimalFormat("#.0");
switch (type) {
case 0:
heatBinding.setBodyTemp(df.format(temp));
heatBinding.setTempout(df.format(tempOut));
} else {
- heatBinding.setBodyTemp(df.format(animal));
+ if (".0".equals(df.format(animal))) {
+ heatBinding.setBodyTemp("0.0");
+ } else {
+ heatBinding.setBodyTemp(df.format(animal));
+ }
heatBinding.setWristTemp(df.format(temp));
heatBinding.setTempout(df.format(tempOut));
}
}
ServiceUtil.unBindServiceUtil(context, connection);
} catch (Exception e) {
+ e.printStackTrace();
} finally {
mService = null;
tempInterface = null;
IcLog.i(TAG, "state error === > " + state);
return;
}
- if (state == STATE_ANTI_OFF && mService == null) {
- bindWorkService(AnimalHeatActivity.this);
- } else if (state == STATE_ANTI_ON) {
+ if (state == STATE_ANTI_OFF) {
+ heatBinding.setCheckTips(getString(R.string.no_wearing_device_tips_text));
//脱落了,给出提示
- Toast.makeText(context, context.getString(R.string.no_wearing_device_tips_text),
- Toast.LENGTH_SHORT).show();
+ } else if (state == STATE_ANTI_ON && mService == null) {
+ bindWorkService(AnimalHeatActivity.this);
+ }
+
+ if (state == STATE_ANTI_ON && currentTestType == 1) {
+ //判断状态,如果已经检测完了,就显示检测完成
+ heatBinding.setCheckTips(getString(R.string.activity_temp_tips_end));
}
}
};
@Override
protected void onObserveModelValue(BaseModel baseModel) {
- L02MainModel mainModel = (L02MainModel)baseModel;
- observePhoneValue( mainModel);
+ L02MainModel mainModel = (L02MainModel) baseModel;
+ observePhoneValue(mainModel);
observeBatteryValue(mainModel);
observeDataTimeValue(mainModel);
observeHardwareValue(mainModel);
mainBinding = FragmentS123MainBinding.inflate(inflater, container, false);
mainBinding.setHeartValue(String.valueOf(SPUtils.getBloodHeartSP(mContext)));
- mainBinding.setTempValue(String.format("%.1f",SPUtils.getTempSP(mContext)));
+ mainBinding.setTempValue(String.format("%.1f", SPUtils.getTempSP(mContext)));
mainBinding.setSpo2value(String.valueOf(SPUtils.getBloodSPo2SP(mContext)));
- mainBinding.setOutTempValue(String.format("%.1f",SPUtils.getTempOutSP(mContext)));
- chargingState=false;
+ mainBinding.setOutTempValue(String.format("%.1f", SPUtils.getTempOutSP(mContext)));
+ mainBinding.setBatteryFull(false);
+ chargingState = false;
mainBinding.setStepValue("0");
- if(SystemUtils.isS123())
- {
- Log.i(TAG,"isS123");
+ if (SystemUtils.isS123()) {
+ Log.i(TAG, "isS123");
mainBinding.setShowStep(View.GONE);
mainBinding.setShowTemp(View.VISIBLE);
- if (SystemUtils.showOutTemp()){
- Log.i(TAG,"show out temp");
+ if (SystemUtils.showOutTemp()) {
+ Log.i(TAG, "show out temp");
mainBinding.setShowOutTemp(View.VISIBLE);
- }else{
- Log.i(TAG,"donot show out temp");
+ } else {
+ Log.i(TAG, "donot show out temp");
mainBinding.setShowOutTemp(View.GONE);
}
- }else{
- Log.i(TAG,"not S123");
+ } else {
+ Log.i(TAG, "not S123");
mainBinding.setShowTemp(View.GONE);
mainBinding.setShowOutTemp(View.GONE);
mainBinding.setShowStep(View.VISIBLE);
@Override
public void onResume() {
super.onResume();
- if(chargingState){
- if(mainBinding != null){
+ if (chargingState) {
+ if (mainBinding != null) {
mainBinding.setBatteryCharge(true);
}
}
@Override
public void onPause() {
super.onPause();
- if(chargingState){
- if(mainBinding != null){
+ if (chargingState) {
+ if (mainBinding != null) {
mainBinding.setBatteryCharge(false);
}
}
}
private void observePhoneValue(L02MainModel model) {
- model.getObservablePhoneType().observe(this, resID ->{
- if(mainBinding != null){
+ model.getObservablePhoneType().observe(this, resID -> {
+ if (mainBinding != null) {
mainBinding.setPhoneNetType(resID);
}
});
- model.getObservableSignal().observe(this, resID ->{
- if(mainBinding != null){
- if(resID == L02Icon.l02SignalResId[0]
- || resID == L02Icon.l02SignalResId[1]){
+ model.getObservableSignal().observe(this, resID -> {
+ if (mainBinding != null) {
+ if (resID == L02Icon.l02SignalResId[0]
+ || resID == L02Icon.l02SignalResId[1]) {
mainBinding.setPhoneShow(false);
- }else{
+ } else {
mainBinding.setPhoneShow(true);
}
mainBinding.setPhoneSignal(resID);
}
});
- model.getObservableTransport().observe(this, resID -> {
- if(mainBinding != null){
- mainBinding.setPhoneTransport(resID);
- }
- });
-
- model.getObservableBTStatus().observe(this,btStatus ->{
- if(mainBinding !=null){
+ model.getObservableBTStatus().observe(this, btStatus -> {
+ if (mainBinding != null) {
mainBinding.setBtStatus(btStatus);
}
});
- model.getObservableWiFiStatus().observe(this, wifiStatus ->{
- if(mainBinding !=null){
+ model.getObservableWiFiStatus().observe(this, wifiStatus -> {
+ if (mainBinding != null) {
mainBinding.setWifiStatus(wifiStatus);
}
});
- model.getObservableGpsStatus().observe(this, gpsStatus ->{
- if(mainBinding !=null){
+ model.getObservableGpsStatus().observe(this, gpsStatus -> {
+ if (mainBinding != null) {
mainBinding.setGpsStatus(gpsStatus);
}
});
}
private void observeBatteryValue(L02MainModel model) {
- model.getObservableBatteryValue().observe(this, value ->{
- if(mainBinding != null){
+ model.getObservableBTIsFull().observe(this, isFull -> {
+ if (mainBinding != null) {
+ mainBinding.setBatteryFull(isFull);
+ }
+ });
+ model.getObservableBatteryValue().observe(this, value -> {
+ if (mainBinding != null) {
mainBinding.setBatteryValue(value);
}
});
- model.getObservableBattery().observe(this, resID ->{
- if(mainBinding != null){
+ model.getObservableBattery().observe(this, resID -> {
+ if (mainBinding != null) {
mainBinding.setBatteryDrawable(resID);
}
});
model.getObservableBatteryCharging().observe(this, state -> {
- if(chargingState != state){
- chargingState =state;
- if(mainBinding != null){
+ if (chargingState != state) {
+ chargingState = state;
+ if (mainBinding != null) {
mainBinding.setBatteryCharge(chargingState);
}
}
}
private void observeDataTimeValue(L02MainModel model) {
- model.getObservableWeek().observe(this, week ->{
- if(mainBinding != null){
+ model.getObservableWeek().observe(this, week -> {
+ if (mainBinding != null) {
mainBinding.setWatchWeek(week);
}
});
model.getObservableYear().observe(this, year -> {
- if(mainBinding != null){
+ if (mainBinding != null) {
mainBinding.setWatchDate(year);
}
});
model.getObservableTime().observe(this, time -> {
- if(mainBinding != null){
+ if (mainBinding != null) {
updateTimeValue(time);
}
});
}
private void observeHardwareValue(L02MainModel model) {
- model.getObservableHardwareHeart().observe(this, heart ->{
- if(mainBinding != null){
+ model.getObservableHardwareHeart().observe(this, heart -> {
+ if (mainBinding != null) {
mainBinding.setHeartValue(heart);
}
});
model.getObservableHardwarePed().observe(this, ped -> {
- if(mainBinding != null){
+ if (mainBinding != null) {
mainBinding.setStepValue(ped);
}
});
model.getObservableHardwareTemp().observe(this, temp -> {
- if(mainBinding != null){
- IcLog.i(TAG,"action get temp "+temp);
+ if (mainBinding != null) {
+ IcLog.i(TAG, "action get temp " + temp);
mainBinding.setTempValue(temp);
}
});
model.getObservableHardwareTempOut().observe(this, temp -> {
- if(mainBinding != null){
- IcLog.i(TAG,"action get tempOut "+temp);
+ if (mainBinding != null) {
+ IcLog.i(TAG, "action get tempOut " + temp);
mainBinding.setOutTempValue(temp);
}
});
model.getObservableHardwareHeartSpo2().observe(this, spo2 -> {
- if(mainBinding != null){
- IcLog.i(TAG,"action get SPo2 "+spo2);
+ if (mainBinding != null) {
+ IcLog.i(TAG, "action get SPo2 " + spo2);
mainBinding.setSpo2value(spo2);
}
});
}
- private void updateTimeValue(int[] value){
- IcLog.i("TEST","updateTimeValue");
+ private void updateTimeValue(int[] value) {
+ IcLog.i("TEST", "updateTimeValue");
mainBinding.setHourTen(value[0]);
mainBinding.setHourBit(value[1]);
mainBinding.setMinuteTen(value[2]);
private L02MainModel(Application application) {
super(application);
- PhoneStatePresenter phonePresenter = ((IcLauncherApplication)application).getPhonePresenter();
- HardwarePresenter hardwarePresenter = ((IcLauncherApplication)application).getHardwarePresenter();
+ PhoneStatePresenter phonePresenter = ((IcLauncherApplication) application).getPhonePresenter();
+ HardwarePresenter hardwarePresenter = ((IcLauncherApplication) application).getHardwarePresenter();
- addPresenterList(PHONE_LIST_INDEX,phonePresenter);
- addPresenterList(HARDWARE_LIST_INDEX,hardwarePresenter);
+ addPresenterList(PHONE_LIST_INDEX, phonePresenter);
+ addPresenterList(HARDWARE_LIST_INDEX, hardwarePresenter);
PresenterCycle state = getPresenterList(TIME_LIST_INDEX);
- if(state != null){
- ((TimeDatePresenter)state).setAnalogClock(false);
+ if (state != null) {
+ ((TimeDatePresenter) state).setAnalogClock(false);
}
}
public LiveData<Integer> getObservablePhoneType() {
PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
- if(state != null){
- return ((PhoneStatePresenter)state).getPhoneTypeObservable();
+ if (state != null) {
+ return ((PhoneStatePresenter) state).getPhoneTypeObservable();
}
return null;
}
public LiveData<Integer> getObservableSignal() {
PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
- if(state != null){
- return ((PhoneStatePresenter)state).getPhoneSignalObservable();
+ if (state != null) {
+ return ((PhoneStatePresenter) state).getPhoneSignalObservable();
}
return null;
}
public LiveData<Integer> getObservableTransport() {
PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
- if(state != null){
- return ((PhoneStatePresenter)state).getPhoneTransportObservable();
+ if (state != null) {
+ return ((PhoneStatePresenter) state).getPhoneTransportObservable();
}
return null;
}
public LiveData<Integer> getObservableBattery() {
PresenterCycle state = getPresenterList(BATTERY_LIST_INDEX);
- if(state != null){
- return ((BatteryPresenter)state).getObsBatteryResID();
+ if (state != null) {
+ return ((BatteryPresenter) state).getObsBatteryResID();
}
return null;
}
public LiveData<Boolean> getObservableBatteryCharging() {
PresenterCycle state = getPresenterList(BATTERY_LIST_INDEX);
- if(state != null){
- return ((BatteryPresenter)state).getObsBatteryCharging();
+ if (state != null) {
+ return ((BatteryPresenter) state).getObsBatteryCharging();
+ }
+ return null;
+ }
+
+ public LiveData<Boolean> getObservableBTIsFull() {
+ PresenterCycle state = getPresenterList(BATTERY_LIST_INDEX);
+ if (state != null) {
+ return ((BatteryPresenter) state).getObsBatteryIsFull();
}
return null;
}
public LiveData<String> getObservableBatteryValue() {
PresenterCycle state = getPresenterList(BATTERY_LIST_INDEX);
- if(state != null){
- return ((BatteryPresenter)state).getObsBatteryValue();
+ if (state != null) {
+ return ((BatteryPresenter) state).getObsBatteryValue();
}
return null;
}
public LiveData<String> getObservableHardwareHeart() {
PresenterCycle state = getPresenterList(HARDWARE_LIST_INDEX);
- if(state != null){
- return ((HardwarePresenter)state).getObsHardwareHeart();
+ if (state != null) {
+ return ((HardwarePresenter) state).getObsHardwareHeart();
}
return null;
}
public LiveData<String> getObservableHardwarePed() {
PresenterCycle state = getPresenterList(HARDWARE_LIST_INDEX);
- if(state != null){
- return ((HardwarePresenter)state).getObsHardwarePed();
+ if (state != null) {
+ return ((HardwarePresenter) state).getObsHardwarePed();
}
return null;
}
+
public LiveData<String> getObservableHardwareTemp() {
PresenterCycle state = getPresenterList(HARDWARE_LIST_INDEX);
- if(state != null){
- return ((HardwarePresenter)state).getObsHardwareTemp();
+ if (state != null) {
+ return ((HardwarePresenter) state).getObsHardwareTemp();
}
return null;
}
+
public LiveData<String> getObservableHardwareTempOut() {
PresenterCycle state = getPresenterList(HARDWARE_LIST_INDEX);
- if(state != null){
- return ((HardwarePresenter)state).getObsHardwareTempOut();
+ if (state != null) {
+ return ((HardwarePresenter) state).getObsHardwareTempOut();
}
return null;
}
public LiveData<String> getObservableHardwareHeartSpo2() {
PresenterCycle state = getPresenterList(HARDWARE_LIST_INDEX);
- if(state != null){
- return ((HardwarePresenter)state).getObsHardwareHeartSpo2();
+ if (state != null) {
+ return ((HardwarePresenter) state).getObsHardwareHeartSpo2();
}
return null;
}
+
public LiveData<String> getObservableWeek() {
PresenterCycle state = getPresenterList(TIME_LIST_INDEX);
- if(state != null){
- return ((TimeDatePresenter)state).getObsWeek();
+ if (state != null) {
+ return ((TimeDatePresenter) state).getObsWeek();
}
return null;
}
public LiveData<String> getObservableYear() {
PresenterCycle state = getPresenterList(TIME_LIST_INDEX);
- if(state != null){
- return ((TimeDatePresenter)state).getObsYear();
+ if (state != null) {
+ return ((TimeDatePresenter) state).getObsYear();
}
return null;
}
public LiveData<int[]> getObservableTime() {
PresenterCycle state = getPresenterList(TIME_LIST_INDEX);
- if(state != null){
- return ((TimeDatePresenter)state).getObsTime();
+ if (state != null) {
+ return ((TimeDatePresenter) state).getObsTime();
}
return null;
}
public LiveData<Boolean> getObservableBTStatus() {
PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
- if(state != null){
- return ((PhoneStatePresenter)state).getBTStatusObservalbe();
+ if (state != null) {
+ return ((PhoneStatePresenter) state).getBTStatusObservalbe();
}
return null;
}
public LiveData<Boolean> getObservableWiFiStatus() {
PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
- if(state != null){
- return ((PhoneStatePresenter)state).getWiFiStatusObservable();
+ if (state != null) {
+ return ((PhoneStatePresenter) state).getWiFiStatusObservable();
}
return null;
}
+
public LiveData<Boolean> getObservableGpsStatus() {
PresenterCycle state = getPresenterList(PHONE_LIST_INDEX);
- if(state != null){
- return ((PhoneStatePresenter)state).getGpsStatusObservable();
+ if (state != null) {
+ return ((PhoneStatePresenter) state).getGpsStatusObservable();
}
return null;
}
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.os.Build;
+import android.telephony.IccOpenLogicalChannelResponse;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import androidx.annotation.RequiresApi;
+import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
+import com.ic.launcher.R;
import com.ic.launcher.configure.l02.L02Icon;
import com.ic.launcher.util.IcLog;
import com.ic.launcher.util.SoundPlayUtils;
private MediatorLiveData<String> mObsBatteryValue;
private MediatorLiveData<Boolean> mObsBatteryCharging;
+ private MediatorLiveData<Boolean> mObsBatteryIsFull;
//comment by TrillGates:
//从代码上看,这个是用于更新点亮图标的,如果插电了
//那么会显示动画
mObsBatteryValue = new MediatorLiveData<>();
mObsBatteryCharging = new MediatorLiveData<>();
mObsBatteryResID = new MediatorLiveData<>();
+ mObsBatteryIsFull = new MediatorLiveData<>();
mObsLowPower = new MediatorLiveData<>();
mObsLowPowerValue = new MediatorLiveData<>();
}
}
};
-
+
private void updateBatteryValue(int rawlevel, int scale, int status) {
int level = -1;
mObsBatteryValue.setValue(level + "%");
mObsLowPowerValue.setValue(level + "%");
-
+ mObsBatteryIsFull.setValue(level == 100);
+ IcLog.i(TAG, "status === > " + status + " level -- > " + level);
switch (status) {
case BatteryManager.BATTERY_STATUS_CHARGING:
mObsLowPower.setValue(false);
break;
case BatteryManager.BATTERY_STATUS_FULL:
updateBatteryFullValue();
- mObsBatteryResID.setValue(L02Icon.l02BatteryResId[getBatteryLevel(level)]);
+ //充电满了,要显示满了的图标
+ if (mObsBatteryCharging.getValue()) {
+ mObsBatteryResID.setValue(R.mipmap.l02_battery_5);
+ } else {
+ mObsBatteryResID.setValue(L02Icon.l02BatteryResId[getBatteryLevel(level)]);
+ }
break;
default:
mObsBatteryResID.setValue(L02Icon.l02BatteryResId[getBatteryLevel(level)]);
}
private int getBatteryLevel(int level) {
- int index = 5;
- if (level > 85 && level < 100) {
+ IcLog.i(TAG, "level == > " + level);
+ int index;
+ if (level == 100) {
+ index = 5;
+ } else if (level > 85) {
index = 4;
} else if (level > 65) {
index = 3;
index = 2;
} else if (level > 15) {
index = 1;
- } else if (level > 7) {
+ } else {
index = 0;
}
public void playSoundIndex(int index) {
playUtils.playKeyboardSound(mContext, index);
}
+
+ public LiveData<Boolean> getObsBatteryIsFull() {
+ return mObsBatteryIsFull;
+ }
}
@Override
public void onPresenterResume() {
super.onPresenterResume();
- IcLog.i(TAG,"onPresenterResume");
- if(mQueryThread == null){
+ IcLog.i(TAG, "onPresenterResume");
+ if (mQueryThread == null) {
mQueryThread = new Thread(queryState);
mQueryThread.start();
- }else if(queryState != null){
+ } else if (queryState != null) {
queryState.resumeQueryThread();
}
}
@Override
public void onPresenterPause() {
super.onPresenterPause();
- IcLog.i(TAG,"onPresenterPause");
+ IcLog.i(TAG, "onPresenterPause");
if (mQueryThread != null && queryState != null) {
queryState.pauseQueryThread();
}
@Override
public void onPresenterDestroy() {
super.onPresenterDestroy();
- IcLog.i(TAG,"onPresenterDestroy");
+ IcLog.i(TAG, "onPresenterDestroy");
if (mQueryThread != null) {
mQueryThread.interrupt();
}
}
public PhoneStatePresenter(Context context) {
- IcLog.i(TAG,"PhoneStatePresenter");
+ IcLog.i(TAG, "PhoneStatePresenter");
mObsPhoneTypeID = new MediatorLiveData<>();
mObsPhoneSignalID = new MediatorLiveData<>();
mObsPhoneTransportID = new MediatorLiveData<>();
mObsBTStatusID = new MediatorLiveData<>();
mObsWiFiStatusID = new MediatorLiveData<>();
mObsGpsStatusID = new MediatorLiveData<>();
- queryState = new QueryPhoneState(context,mObsPhoneTypeID,mObsPhoneSignalID,mObsPhoneTransportID,mObsBTStatusID,mObsWiFiStatusID,mObsGpsStatusID);
+ queryState = new QueryPhoneState(context, mObsPhoneTypeID,
+ mObsPhoneSignalID,
+ mObsPhoneTransportID, mObsBTStatusID,
+ mObsWiFiStatusID,
+ mObsGpsStatusID);
}
public LiveData<Integer> getPhoneTypeObservable() {
return mObsBTStatusID;
}
+
public LiveData<Boolean> getWiFiStatusObservable() {
return mObsWiFiStatusID;
}
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
+import android.telephony.IccOpenLogicalChannelResponse;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewTreeObserver;
import androidx.databinding.BindingAdapter;
import com.ic.launcher.R;
+import com.ic.launcher.util.IcLog;
public class WidgetBatteryStateView extends LinearLayout {
+ private static final String TAG = "WidgetBatteryStateView";
private TextView batteryTv;
private ImageView batteryIv;
*
* @param charge
*/
- public void updateBatteryChargeState(boolean charge) {
- if (charge) {
+ public void updateBatteryChargeState(boolean charge, boolean isFull) {
+ IcLog.i(TAG, "charge == > " + charge);
+ IcLog.i(TAG, "isFull == > " + isFull);
+ if (charge && !isFull) {
+ //判断有没有充满
//充电状态
if (animationDrawable == null) {
batteryIv.setImageResource(R.drawable.l02_battery_charging_anim);
animationDrawable = null;
}
}
+
+ if (charge && isFull) {
+ batteryIv.setImageResource(R.mipmap.l02_battery_5);
+ }
}
- @BindingAdapter(value = {"batteryValue", "batteryDrawable", "batteryCharge"}, requireAll = false)
- public static void updateBatteryState(WidgetBatteryStateView view, String value, int imgRes, boolean charge) {
+ @BindingAdapter(value = {"batteryValue", "batteryDrawable", "batteryCharge", "isFull"}, requireAll = false)
+ public static void updateBatteryState(WidgetBatteryStateView view, String value, int imgRes, boolean charge,
+ boolean isFull) {
if (view != null) {
view.updateBatteryValue(value);
view.updateBatteryDrawable(imgRes);
- view.updateBatteryChargeState(charge);
+ view.updateBatteryChargeState(charge, isFull);
}
}
}
android:background="@mipmap/qs_background"
tools:context=".AnimalHeatActivity">
- <ImageView
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.25" />
+
+ <ImageView
+ android:id="@+id/imageView2"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_marginTop="10dp"
+ android:layout_marginEnd="20dp"
android:background="@android:color/transparent"
android:src="@drawable/ic_temp_human"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.2"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.206" />
+ app:layout_constraintEnd_toStartOf="@+id/guideline7"
+ app:layout_constraintTop_toTopOf="parent" />
+
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:text="@string/activity_temp_str"
- android:textColor="#FB8C00"
- android:textSize="28sp"
- app:layout_constraintBottom_toBottomOf="parent"
+ android:text="@string/activity_temp_unit"
+ android:textColor="#FFFFFF"
+ android:textSize="38sp"
+ android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
+ app:layout_constraintBottom_toTopOf="@+id/guideline6"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.2"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.053" />
+ app:layout_constraintStart_toStartOf="@+id/guideline8"
+ app:layout_constraintTop_toTopOf="@+id/guideline5" />
+
<TextView
- android:id="@+id/temperature_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:gravity="right"
- android:text="@{bodyTemp}"
+ android:text="@string/activity_temp_str"
android:textColor="#FFFFFF"
- android:textSize="50sp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/textView3"
- app:layout_constraintHorizontal_bias="0.884"
+ android:textSize="26sp"
+ app:layout_constraintBottom_toTopOf="@+id/guideline"
+ app:layout_constraintEnd_toStartOf="@+id/imageView2"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.183" />
+ app:layout_constraintTop_toTopOf="parent" />
<TextView
- android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:text="@string/activity_temp_unit"
+ android:text="@string/activity_temp_wrist_str"
android:textColor="#FFFFFF"
- android:textSize="28sp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.899"
+ android:textSize="26sp"
+ app:layout_constraintBottom_toTopOf="@+id/guideline5"
+ app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.202" />
+ app:layout_constraintTop_toTopOf="@+id/guideline" />
- <ImageView
- android:id="@+id/imageView"
+
+ <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:src="@drawable/ic_temp_wrist"
- android:visibility="@{disableWristTemp ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
+ android:text="@string/activity_temp_unit"
+ android:textColor="#FFFFFF"
+ android:textSize="38sp"
+ android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
+ app:layout_constraintBottom_toTopOf="@+id/guideline5"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.2"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.513" />
+ app:layout_constraintStart_toStartOf="@+id/guideline8"
+ app:layout_constraintTop_toTopOf="@+id/guideline" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:text="@string/activity_temp_wrist_str"
- android:textColor="#00ACC1"
- android:textSize="28sp"
- android:visibility="@{disableWristTemp ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
+ android:text="@string/activity_temp_unit"
+ android:textColor="#FFFFFF"
+ android:textSize="38sp"
+ android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
+ app:layout_constraintBottom_toTopOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.18"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.354" />
+ app:layout_constraintStart_toStartOf="@+id/guideline8"
+ app:layout_constraintTop_toTopOf="parent" />
- <TextView
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.5" />
+
+ <ImageView
+ android:id="@+id/imageView"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_marginTop="10dp"
+ android:layout_marginEnd="20dp"
android:background="@android:color/transparent"
- android:gravity="right"
- android:text="@{wristTemp}"
- android:textColor="#FFFFFF"
- android:textSize="50sp"
+ android:src="@drawable/ic_temp_wrist"
android:visibility="@{disableWristTemp ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/textView2"
- app:layout_constraintHorizontal_bias="0.884"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintEnd_toStartOf="@+id/guideline7"
+ app:layout_constraintTop_toTopOf="@+id/guideline" />
+
+ <ImageView
+ android:id="@+id/imageView3"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_marginEnd="20dp"
+ android:background="@android:color/transparent"
+ android:src="@mipmap/outtemp"
+ android:visibility="@{disableWristTemp ? View.GONE : View.VISIBLE}"
+ app:layout_constraintBottom_toTopOf="@+id/guideline6"
+ app:layout_constraintEnd_toStartOf="@+id/guideline7"
+ app:layout_constraintTop_toTopOf="@+id/guideline5" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.75" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline9"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ app:layout_constraintGuide_percent="0.90" />
+
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline7"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.49" />
<TextView
- android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:text="@string/activity_temp_unit"
+ android:text="@{checkTips}"
android:textColor="#FFFFFF"
android:textSize="28sp"
- android:visibility="@{disableWristTemp ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintBottom_toTopOf="@+id/guideline9"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.899"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.5" />
+ app:layout_constraintTop_toTopOf="@+id/guideline6" />
+ <androidx.constraintlayout.widget.Guideline
+ android:id="@+id/guideline8"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ app:layout_constraintGuide_percent="0.8" />
+
+ <com.github.silvestrpredko.dotprogressbar.DotProgressBar
+ android:id="@+id/dot_progress_bar"
+ android:layout_width="match_parent"
+ android:layout_height="30dp"
+ android:background="@android:color/transparent"
+ android:visibility="@{showLoading ? View.VISIBLE : View.GONE}"
+ app:amount="5"
+ app:animationDirection="left"
+ app:duration="@android:integer/config_mediumAnimTime"
+ app:endColor="@color/teal_A200"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintTop_toTopOf="@+id/guideline9"
+ app:startColor="@color/lime_A400"
+ tools:layout_editor_absoluteX="4dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="@string/activity_temp_outside"
- android:textColor="#00ACC1"
- android:textSize="28sp"
+ android:textColor="#FFFFFF"
+ android:textSize="26sp"
android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.18"
+ app:layout_constraintBottom_toTopOf="@+id/guideline6"
+ app:layout_constraintEnd_toStartOf="@+id/imageView3"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.754" />
- <!-- <ImageView-->
- <!-- android:layout_width="wrap_content"-->
- <!-- android:layout_height="wrap_content"-->
- <!-- android:background="@android:color/transparent"-->
- <!-- android:src="@drawable/ic_temp_wrist"-->
- <!-- app:layout_constraintBottom_toBottomOf="parent"-->
- <!-- app:layout_constraintEnd_toEndOf="parent"-->
- <!-- app:layout_constraintHorizontal_bias="0.2"-->
- <!-- android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"-->
- <!-- app:layout_constraintStart_toStartOf="parent"-->
- <!-- app:layout_constraintTop_toTopOf="parent"-->
- <!-- app:layout_constraintVertical_bias="0.8" />-->
+ app:layout_constraintTop_toTopOf="@+id/guideline5" />
+
<TextView
+ android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:gravity="right"
android:text="@{tempout}"
android:textColor="#FFFFFF"
android:textSize="50sp"
android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/textView"
- app:layout_constraintHorizontal_bias="0.884"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.81" />
+ app:layout_constraintBottom_toTopOf="@+id/guideline6"
+ app:layout_constraintEnd_toStartOf="@+id/guideline8"
+ app:layout_constraintTop_toTopOf="@+id/guideline5" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:text="@string/activity_temp_unit"
+ android:text="@{bodyTemp}"
android:textColor="#FFFFFF"
- android:textSize="28sp"
+ android:textSize="50sp"
android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.899"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.8" />
+ app:layout_constraintBottom_toTopOf="@+id/guideline"
+ app:layout_constraintEnd_toStartOf="@+id/guideline8"
+ app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:text="@{checkTips}"
+ android:text="@{wristTemp}"
android:textColor="#FFFFFF"
- android:textSize="28sp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.9" />
-
- <com.github.silvestrpredko.dotprogressbar.DotProgressBar
- android:id="@+id/dot_progress_bar"
- android:layout_width="wrap_content"
- android:layout_height="30dp"
- android:background="@android:color/transparent"
- android:visibility="@{showLoading ? View.VISIBLE : View.GONE}"
- app:amount="5"
- app:animationDirection="left"
- app:duration="@android:integer/config_mediumAnimTime"
- app:endColor="@color/teal_A200"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.98"
- app:startColor="@color/lime_A400" />
+ android:textSize="50sp"
+ android:visibility="@{disableTempOut ? View.GONE : View.VISIBLE}"
+ app:layout_constraintBottom_toTopOf="@+id/guideline5"
+ app:layout_constraintEnd_toStartOf="@+id/guideline8"
+ app:layout_constraintTop_toTopOf="@+id/guideline" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
name="batteryCharge"
type="boolean" />
+ <variable
+ name="batteryFull"
+ type="boolean" />
+
<variable
name="hourTen"
type="int" />
android:layout_marginEnd="10dp"
app:batteryCharge="@{batteryCharge}"
app:batteryDrawable="@{batteryDrawable}"
- app:batteryValue="@{batteryValue}" />
+ app:batteryValue="@{batteryValue}"
+ app:isFull="@{batteryFull}" />
</RelativeLayout>
android:id="@+id/date_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
android:layout_below="@id/l02_time_image"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:gravity="center"
- >
+ android:orientation="horizontal">
<TextView
style="@style/watchDateTextStyle"
- android:text="@{watchDate}"
android:layout_weight="1"
android:gravity="center"
- />
+ android:text="@{watchDate}" />
<TextView
style="@style/watchDateTextStyle"
android:layout_weight="1"
- android:text="@{watchWeek}"
android:gravity="center"
- />
+ android:text="@{watchWeek}" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:visibility="@{showOutTemp}"
- android:gravity="center">
+ android:gravity="center"
+ android:visibility="@{showOutTemp}">
<ImageView
android:id="@+id/l02_temp_out"
android:layout_width="40dp"
android:layout_height="40dp"
- android:visibility="@{showOutTemp}"
android:layout_alignLeft="@+id/l02_temp_out_value"
android:layout_alignRight="@+id/l02_temp_out_value"
- android:src="@mipmap/outtemp" />
+ android:src="@mipmap/outtemp"
+ android:visibility="@{showOutTemp}" />
<TextView
android:id="@+id/l02_temp_out_value"
android:layout_below="@+id/l02_temp_out"
android:layout_weight="1"
android:gravity="center"
- android:visibility="@{showOutTemp}"
android:text="@{outTempValue}"
- android:textAlignment="center" />
+ android:textAlignment="center"
+ android:visibility="@{showOutTemp}" />
</RelativeLayout>
<string name="activity_temp_unit">℃</string>
<string name="activity_temp_tips_check">正在测量</string>
<string name="activity_temp_tips_end">测量完成</string>
- <string name="activity_temp_outside">环境温度</string>
+ <string name="activity_temp_outside">环境</string>
</resources>
\ No newline at end of file