mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-26 09:44:31 +02:00
removed setConvertedWeight (..) in MainActivity
This commit is contained in:
@@ -100,10 +100,10 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
|||||||
final byte ctrlByte = weightBytes[5];
|
final byte ctrlByte = weightBytes[5];
|
||||||
final boolean allValues = isBitSet(ctrlByte, 1);
|
final boolean allValues = isBitSet(ctrlByte, 1);
|
||||||
final boolean weightStabilized = isBitSet(ctrlByte, 0);
|
final boolean weightStabilized = isBitSet(ctrlByte, 0);
|
||||||
|
final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser();
|
||||||
|
|
||||||
if (weightStabilized) {
|
if (weightStabilized) {
|
||||||
//The weight is stabilized, now we want to measure all available values
|
//The weight is stabilized, now we want to measure all available values
|
||||||
final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser();
|
|
||||||
byte gender = selectedUser.isMale() ? (byte)0x00: (byte)0x01;
|
byte gender = selectedUser.isMale() ? (byte)0x00: (byte)0x01;
|
||||||
byte height = (byte) (selectedUser.getBodyHeight() & 0xFF);
|
byte height = (byte) (selectedUser.getBodyHeight() & 0xFF);
|
||||||
byte age = (byte)(selectedUser.getAge(new Date()) & 0xff);
|
byte age = (byte)(selectedUser.getAge(new Date()) & 0xff);
|
||||||
@@ -152,7 +152,7 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
|||||||
scaleBtData.setWater(water);
|
scaleBtData.setWater(water);
|
||||||
scaleBtData.setBone(boneWeight);
|
scaleBtData.setBone(boneWeight);
|
||||||
}
|
}
|
||||||
scaleBtData.setWeight(weight);
|
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||||
addScaleData(scaleBtData);
|
addScaleData(scaleBtData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,9 @@ import android.content.SharedPreferences;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.health.openscale.core.OpenScale;
|
||||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||||
|
import com.health.openscale.core.datatypes.ScaleUser;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -238,9 +240,10 @@ public class BluetoothMiScale extends BluetoothCommunication {
|
|||||||
|
|
||||||
// Is the year plausible? Check if the year is in the range of 20 years...
|
// Is the year plausible? Check if the year is in the range of 20 years...
|
||||||
if (validateDate(date_time, 20)) {
|
if (validateDate(date_time, 20)) {
|
||||||
|
final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser();
|
||||||
ScaleMeasurement scaleBtData = new ScaleMeasurement();
|
ScaleMeasurement scaleBtData = new ScaleMeasurement();
|
||||||
|
|
||||||
scaleBtData.setWeight(weight);
|
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||||
scaleBtData.setDateTime(date_time);
|
scaleBtData.setDateTime(date_time);
|
||||||
|
|
||||||
addScaleData(scaleBtData);
|
addScaleData(scaleBtData);
|
||||||
|
@@ -211,9 +211,10 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
|
|||||||
|
|
||||||
// Is the year plausible? Check if the year is in the range of 20 years...
|
// Is the year plausible? Check if the year is in the range of 20 years...
|
||||||
if (validateDate(date_time, 20)) {
|
if (validateDate(date_time, 20)) {
|
||||||
|
final ScaleUser selectedUser = OpenScale.getInstance(context).getSelectedScaleUser();
|
||||||
ScaleMeasurement scaleBtData = new ScaleMeasurement();
|
ScaleMeasurement scaleBtData = new ScaleMeasurement();
|
||||||
|
|
||||||
scaleBtData.setWeight(weight);
|
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||||
scaleBtData.setDateTime(date_time);
|
scaleBtData.setDateTime(date_time);
|
||||||
|
|
||||||
addScaleData(scaleBtData);
|
addScaleData(scaleBtData);
|
||||||
|
@@ -376,8 +376,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
setBluetoothStatusIcon(R.drawable.ic_bluetooth_connection_success);
|
setBluetoothStatusIcon(R.drawable.ic_bluetooth_connection_success);
|
||||||
ScaleMeasurement scaleBtData = (ScaleMeasurement) msg.obj;
|
ScaleMeasurement scaleBtData = (ScaleMeasurement) msg.obj;
|
||||||
|
|
||||||
// scaleBtData.setConvertedWeight(scaleBtData.getWeight(), OpenScale.getInstance(getApplicationContext()).getSelectedScaleUser().getScaleUnit());
|
|
||||||
|
|
||||||
OpenScale.getInstance(getApplicationContext()).addScaleData(scaleBtData);
|
OpenScale.getInstance(getApplicationContext()).addScaleData(scaleBtData);
|
||||||
break;
|
break;
|
||||||
case BT_INIT_PROCESS:
|
case BT_INIT_PROCESS:
|
||||||
|
Reference in New Issue
Block a user