1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-11 11:14:03 +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:
OliE
2017-05-10 18:31:17 +02:00
parent 937c22c096
commit 185051da84
2 changed files with 5 additions and 3 deletions

View File

@@ -375,9 +375,13 @@ public class BluetoothMiScale extends BluetoothCommunication {
byte[] data = characteristic.getValue();
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 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");
invokeInitBluetoothCmd(gatt);
} else {

View File

@@ -421,8 +421,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
if(convertView == null){
row = new LinearLayout(getContext());
row.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
convertView = row;
for (int i = 0; i< dataList.get(0).size(); i++) {