mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-12 03:34:09 +02:00
fix bug for android 4.4 (LinearLayout$LayoutParams cannot be cast to AbsListView$LayoutParams)
check if month and date is correct on the mi scale if not initialize mi scale again
This commit is contained in:
@@ -375,9 +375,13 @@ public class BluetoothMiScale extends BluetoothCommunication {
|
|||||||
byte[] data = characteristic.getValue();
|
byte[] data = characteristic.getValue();
|
||||||
|
|
||||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||||
|
int currentMonth = Calendar.getInstance().get(Calendar.MONTH)+1;
|
||||||
|
int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
|
||||||
int scaleYear = ((data[1] & 0xFF) << 8) | (data[0] & 0xFF);
|
int scaleYear = ((data[1] & 0xFF) << 8) | (data[0] & 0xFF);
|
||||||
|
int scaleMonth = (int) data[2];
|
||||||
|
int scaleDay = (int) data[3];
|
||||||
|
|
||||||
if (currentYear != scaleYear) {
|
if (currentYear != scaleYear || currentMonth != scaleMonth || currentDay != scaleDay) {
|
||||||
Log.d("BluetoothMiScale", "Current year and scale year is different");
|
Log.d("BluetoothMiScale", "Current year and scale year is different");
|
||||||
invokeInitBluetoothCmd(gatt);
|
invokeInitBluetoothCmd(gatt);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -421,8 +421,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
if(convertView == null){
|
if(convertView == null){
|
||||||
row = new LinearLayout(getContext());
|
row = new LinearLayout(getContext());
|
||||||
row.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
|
|
||||||
|
|
||||||
convertView = row;
|
convertView = row;
|
||||||
|
|
||||||
for (int i = 0; i< dataList.get(0).size(); i++) {
|
for (int i = 0; i< dataList.get(0).size(); i++) {
|
||||||
|
Reference in New Issue
Block a user