public MutableLiveData<Boolean> isServerConnected = new MutableLiveData<>();
//网络类型
public MutableLiveData<String> networkTypeValue = new MutableLiveData<>();
+ //未佩戴状态
+ public MutableLiveData<Boolean> wearState = new MutableLiveData<>();
private Handler handler;
private TelephonyManager mTelephony;
getSignalStrength();
queryPhoneNetworkTypeResId(mTelephony);
}
+ //获取佩戴状态
+ getWearState();
getConnectionState();
handler.postDelayed(this, 3000);
}
});
}
+ private void getWearState() {
+ boolean isAntiOff = SystemUtils.getSystemPropertiesBoolean("persist.sys.ic_antioff",
+ false);
+ if (isAntiOff) {
+ //未佩戴
+ wearState.postValue(Boolean.FALSE);
+ } else {
+ wearState.postValue(Boolean.TRUE);
+ }
+ }
+
private int mOldSimCardState = -1;
private boolean querySimCardState() {
public MutableLiveData<Boolean> gpsState = new MutableLiveData<>();
//蓝牙状态
public MutableLiveData<Boolean> btState = new MutableLiveData<>();
- //未佩戴状态
- public MutableLiveData<Boolean> wearState = new MutableLiveData<>();
//未读预警消息
public MutableLiveData<Boolean> warningReadState = new MutableLiveData<>();
//开启闹钟提示
getGpsState();
getBtState();
//需要监听的
- getWearState();
getUnReadMsgState();
getAlarmState();
getWarningMsgReadState();
// msgUnReadState.postValue(true);
}
- private void getWearState() {
- // wearState.postValue(true);
- }
-
private void getBtState() {
//蓝牙
IntentFilter btFilter = new IntentFilter();
public int bottom = 0;
}
- private int margin = 0;
+ private int margin = 1;
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
item.measure(widthSpec, heightMeasureSpec);
//ICLogger.d("item.getMeasuredWidth() == > " + item.getMeasuredWidth());
//设置孩子的位置,从0开始
- item.setTag(new Position(totalWidth, 0, totalWidth + item.getMeasuredWidth(), item.getMeasuredHeight()));
+ item.setTag(new Position(totalWidth,
+ 0,
+ totalWidth + item.getMeasuredWidth(),
+ item.getMeasuredHeight()));
totalWidth += item.getMeasuredWidth() + margin * 2;
}
int parentWidth = MeasureSpec.makeMeasureSpec(totalWidth, MeasureSpec.EXACTLY);