1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-09-02 21:02:48 +02:00

Minor code cleanups

This commit is contained in:
Erik Johansson
2018-01-14 21:23:12 +01:00
parent 6247e19a3d
commit 3213dbaa85
9 changed files with 13 additions and 12 deletions

View File

@@ -225,7 +225,7 @@ public class OpenScale {
String infoText = String.format(context.getString(R.string.info_new_data_added), String infoText = String.format(context.getString(R.string.info_new_data_added),
scaleMeasurement.getConvertedWeight(scaleUser.getScaleUnit()), scaleMeasurement.getConvertedWeight(scaleUser.getScaleUnit()),
scaleUser.UNIT_STRING[scaleUser.getScaleUnit()], ScaleUser.UNIT_STRING[scaleUser.getScaleUnit()],
dateFormat.format(dateTime) + " " + timeFormat.format(dateTime), dateFormat.format(dateTime) + " " + timeFormat.format(dateTime),
scaleUser.getUserName()); scaleUser.getUserName());
Toast.makeText(context, infoText, Toast.LENGTH_LONG).show(); Toast.makeText(context, infoText, Toast.LENGTH_LONG).show();

View File

@@ -36,7 +36,8 @@ import java.util.UUID;
public abstract class BluetoothCommunication { public abstract class BluetoothCommunication {
public enum BT_STATUS_CODE {BT_RETRIEVE_SCALE_DATA, BT_INIT_PROCESS, BT_CONNECTION_ESTABLISHED, public enum BT_STATUS_CODE {BT_RETRIEVE_SCALE_DATA, BT_INIT_PROCESS, BT_CONNECTION_ESTABLISHED,
BT_CONNECTION_LOST, BT_NO_DEVICE_FOUND, BT_UNEXPECTED_ERROR, BT_SCALE_MESSAGE BT_CONNECTION_LOST, BT_NO_DEVICE_FOUND, BT_UNEXPECTED_ERROR, BT_SCALE_MESSAGE
}; }
public enum BT_MACHINE_STATE {BT_INIT_STATE, BT_CMD_STATE, BT_CLEANUP_STATE} public enum BT_MACHINE_STATE {BT_INIT_STATE, BT_CMD_STATE, BT_CLEANUP_STATE}
public enum BT_DEVICE_ID {CUSTOM_OPENSCALE, MI_SCALE_V1, MI_SCALE_V2, SANITAS_SBF70, MEDISANA_BS444, DIGOO_DGS038H, EXCELVANT_CF369BLE, YUNMAI_MINI, YUNMAI_SE, MGB, EXINGTECH_Y1, BEURER_BF700_800} public enum BT_DEVICE_ID {CUSTOM_OPENSCALE, MI_SCALE_V1, MI_SCALE_V2, SANITAS_SBF70, MEDISANA_BS444, DIGOO_DGS038H, EXCELVANT_CF369BLE, YUNMAI_MINI, YUNMAI_SE, MGB, EXINGTECH_Y1, BEURER_BF700_800}
@@ -244,7 +245,7 @@ public abstract class BluetoothCommunication {
* @param gattCharacteristic the Bluetooth Gatt characteristic * @param gattCharacteristic the Bluetooth Gatt characteristic
* @param status the status code * @param status the status code
*/ */
protected void onBluetoothDataRead(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic, int status) {}; protected void onBluetoothDataRead(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic, int status) {}
/** /**
* Method is triggered if a Bluetooth data from a device is notified or indicated. * Method is triggered if a Bluetooth data from a device is notified or indicated.
@@ -252,7 +253,7 @@ public abstract class BluetoothCommunication {
* @param bluetoothGatt the Bluetooth Gatt * @param bluetoothGatt the Bluetooth Gatt
* @param gattCharacteristic the Bluetooth characteristic * @param gattCharacteristic the Bluetooth characteristic
*/ */
protected void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) {}; protected void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) {}
/** /**
* Set the Bluetooth machine state to a specific state. * Set the Bluetooth machine state to a specific state.
@@ -579,6 +580,6 @@ public abstract class BluetoothCommunication {
BluetoothGattCharacteristic characteristic) { BluetoothGattCharacteristic characteristic) {
onBluetoothDataChange(gatt, characteristic); onBluetoothDataChange(gatt, characteristic);
} }
}; }
} }

View File

@@ -19,7 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
import com.health.openscale.core.datatypes.ScaleUser; import com.health.openscale.core.datatypes.ScaleUser;
public abstract class EstimatedFatMetric { public abstract class EstimatedFatMetric {
public enum FORMULA { BF_DEURENBERG, BF_DEURENBERG_II, BF_EDDY, BF_GALLAGHER, BF_GALLAGHER_ASIAN }; public enum FORMULA { BF_DEURENBERG, BF_DEURENBERG_II, BF_EDDY, BF_GALLAGHER, BF_GALLAGHER_ASIAN }
public static EstimatedFatMetric getEstimatedMetric(FORMULA metric) { public static EstimatedFatMetric getEstimatedMetric(FORMULA metric) {
switch (metric) { switch (metric) {

View File

@@ -19,7 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
import com.health.openscale.core.datatypes.ScaleUser; import com.health.openscale.core.datatypes.ScaleUser;
public abstract class EstimatedLBWMetric { public abstract class EstimatedLBWMetric {
public enum FORMULA { LBW_HUME, LBW_BOER }; public enum FORMULA { LBW_HUME, LBW_BOER }
public static EstimatedLBWMetric getEstimatedMetric(FORMULA metric) { public static EstimatedLBWMetric getEstimatedMetric(FORMULA metric) {
switch (metric) { switch (metric) {

View File

@@ -19,7 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
import com.health.openscale.core.datatypes.ScaleUser; import com.health.openscale.core.datatypes.ScaleUser;
public abstract class EstimatedWaterMetric { public abstract class EstimatedWaterMetric {
public enum FORMULA { TBW_BEHNKE, TBW_DELWAIDECRENIER, TBW_HUMEWEYERS, TBW_LEESONGKIM }; public enum FORMULA { TBW_BEHNKE, TBW_DELWAIDECRENIER, TBW_HUMEWEYERS, TBW_LEESONGKIM }
public static EstimatedWaterMetric getEstimatedMetric(FORMULA metric) { public static EstimatedWaterMetric getEstimatedMetric(FORMULA metric) {
switch (metric) { switch (metric) {

View File

@@ -17,7 +17,7 @@
package com.health.openscale.core.evaluation; package com.health.openscale.core.evaluation;
public class EvaluationResult { public class EvaluationResult {
public static enum EVAL_STATE {LOW, NORMAL, HIGH, UNDEFINED}; public enum EVAL_STATE {LOW, NORMAL, HIGH, UNDEFINED}
public float value; public float value;
public float lowLimit; public float lowLimit;

View File

@@ -21,5 +21,5 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
import java.util.List; import java.util.List;
public interface FragmentUpdateListener { public interface FragmentUpdateListener {
public void updateOnView(List<ScaleMeasurement> scaleMeasurementList); void updateOnView(List<ScaleMeasurement> scaleMeasurementList);
} }

View File

@@ -49,7 +49,7 @@ import static com.health.openscale.gui.views.MeasurementView.MeasurementViewMode
import static com.health.openscale.gui.views.MeasurementView.MeasurementViewMode.VIEW; import static com.health.openscale.gui.views.MeasurementView.MeasurementViewMode.VIEW;
public abstract class MeasurementView extends TableLayout { public abstract class MeasurementView extends TableLayout {
public enum MeasurementViewMode {VIEW, EDIT, ADD, STATISTIC}; public enum MeasurementViewMode {VIEW, EDIT, ADD, STATISTIC}
private TableRow measurementRow; private TableRow measurementRow;
private ImageView iconView; private ImageView iconView;

View File

@@ -16,5 +16,5 @@
package com.health.openscale.gui.views; package com.health.openscale.gui.views;
public interface MeasurementViewUpdateListener { public interface MeasurementViewUpdateListener {
public void onMeasurementViewUpdate(MeasurementView view); void onMeasurementViewUpdate(MeasurementView view);
} }