From 3213dbaa85404112f52fd67725104f8277b5783a Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Sun, 14 Jan 2018 21:23:12 +0100 Subject: [PATCH] Minor code cleanups --- .../main/java/com/health/openscale/core/OpenScale.java | 2 +- .../openscale/core/bluetooth/BluetoothCommunication.java | 9 +++++---- .../openscale/core/bodymetric/EstimatedFatMetric.java | 2 +- .../openscale/core/bodymetric/EstimatedLBWMetric.java | 2 +- .../openscale/core/bodymetric/EstimatedWaterMetric.java | 2 +- .../openscale/core/evaluation/EvaluationResult.java | 2 +- .../openscale/gui/fragments/FragmentUpdateListener.java | 2 +- .../com/health/openscale/gui/views/MeasurementView.java | 2 +- .../gui/views/MeasurementViewUpdateListener.java | 2 +- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java b/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java index b02ad2e0..c38cbd00 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java +++ b/android_app/app/src/main/java/com/health/openscale/core/OpenScale.java @@ -225,7 +225,7 @@ public class OpenScale { String infoText = String.format(context.getString(R.string.info_new_data_added), scaleMeasurement.getConvertedWeight(scaleUser.getScaleUnit()), - scaleUser.UNIT_STRING[scaleUser.getScaleUnit()], + ScaleUser.UNIT_STRING[scaleUser.getScaleUnit()], dateFormat.format(dateTime) + " " + timeFormat.format(dateTime), scaleUser.getUserName()); Toast.makeText(context, infoText, Toast.LENGTH_LONG).show(); diff --git a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java index 619816c3..3edebdc1 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bluetooth/BluetoothCommunication.java @@ -36,7 +36,8 @@ import java.util.UUID; public abstract class BluetoothCommunication { 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 - }; + } + 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} @@ -244,7 +245,7 @@ public abstract class BluetoothCommunication { * @param gattCharacteristic the Bluetooth Gatt characteristic * @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. @@ -252,7 +253,7 @@ public abstract class BluetoothCommunication { * @param bluetoothGatt the Bluetooth Gatt * @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. @@ -579,6 +580,6 @@ public abstract class BluetoothCommunication { BluetoothGattCharacteristic characteristic) { onBluetoothDataChange(gatt, characteristic); } - }; + } } diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedFatMetric.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedFatMetric.java index c4fbac7e..a493e8b6 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedFatMetric.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedFatMetric.java @@ -19,7 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement; import com.health.openscale.core.datatypes.ScaleUser; 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) { switch (metric) { diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedLBWMetric.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedLBWMetric.java index 8474c895..5e300ac7 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedLBWMetric.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedLBWMetric.java @@ -19,7 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement; import com.health.openscale.core.datatypes.ScaleUser; public abstract class EstimatedLBWMetric { - public enum FORMULA { LBW_HUME, LBW_BOER }; + public enum FORMULA { LBW_HUME, LBW_BOER } public static EstimatedLBWMetric getEstimatedMetric(FORMULA metric) { switch (metric) { diff --git a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedWaterMetric.java b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedWaterMetric.java index d0b9808f..81d38f74 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedWaterMetric.java +++ b/android_app/app/src/main/java/com/health/openscale/core/bodymetric/EstimatedWaterMetric.java @@ -19,7 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement; import com.health.openscale.core.datatypes.ScaleUser; 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) { switch (metric) { diff --git a/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationResult.java b/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationResult.java index 17c93082..3fb385b0 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationResult.java +++ b/android_app/app/src/main/java/com/health/openscale/core/evaluation/EvaluationResult.java @@ -17,7 +17,7 @@ package com.health.openscale.core.evaluation; 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 lowLimit; diff --git a/android_app/app/src/main/java/com/health/openscale/gui/fragments/FragmentUpdateListener.java b/android_app/app/src/main/java/com/health/openscale/gui/fragments/FragmentUpdateListener.java index f71a3ebc..adde37f4 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/fragments/FragmentUpdateListener.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/fragments/FragmentUpdateListener.java @@ -21,5 +21,5 @@ import com.health.openscale.core.datatypes.ScaleMeasurement; import java.util.List; public interface FragmentUpdateListener { - public void updateOnView(List scaleMeasurementList); + void updateOnView(List scaleMeasurementList); } diff --git a/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementView.java b/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementView.java index 9f68f8fd..479b38a0 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementView.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementView.java @@ -49,7 +49,7 @@ import static com.health.openscale.gui.views.MeasurementView.MeasurementViewMode import static com.health.openscale.gui.views.MeasurementView.MeasurementViewMode.VIEW; public abstract class MeasurementView extends TableLayout { - public enum MeasurementViewMode {VIEW, EDIT, ADD, STATISTIC}; + public enum MeasurementViewMode {VIEW, EDIT, ADD, STATISTIC} private TableRow measurementRow; private ImageView iconView; diff --git a/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementViewUpdateListener.java b/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementViewUpdateListener.java index 0dec3d1e..63362419 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementViewUpdateListener.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/views/MeasurementViewUpdateListener.java @@ -16,5 +16,5 @@ package com.health.openscale.gui.views; public interface MeasurementViewUpdateListener { - public void onMeasurementViewUpdate(MeasurementView view); + void onMeasurementViewUpdate(MeasurementView view); }