From 129557a1c4a5dede404fa993599617f3c3db95f4 Mon Sep 17 00:00:00 2001 From: Mark Heinis Date: Fri, 20 Jan 2017 14:51:11 +0100 Subject: [PATCH] Fix on Graph percentage Fix on Graph percentage --- .../domoticz/Adapters/DashboardAdapter.java | 4 ++-- .../domoticz/Adapters/SwitchesAdapter.java | 4 ++-- .../domoticz/Adapters/UtilityAdapter.java | 4 ++-- .../nl/hnogames/domoticz/Fragments/Graph.java | 14 ++++++------- app/src/main/res/layout/dialog_graph.xml | 4 ++-- app/version.properties | 8 ++++---- .../Containers/GraphPointInfo.java | 14 ++++++------- .../nl/hnogames/domoticzapi/Domoticz.java | 3 --- .../hnogames/domoticzapi/DomoticzValues.java | 20 +++++++++++++++++++ domoticzapi/version.properties | 8 ++++---- 10 files changed, 50 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java index 2d7566671..ee818398a 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/DashboardAdapter.java @@ -229,11 +229,11 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo, setButtons(holder, Buttons.BUTTON_ON); setPushOnOffSwitchRowData(mDeviceInfo, holder, true); break; - case Domoticz.UTILITIES_TYPE_THERMOSTAT: + case DomoticzValues.Device.Utility.Type.THERMOSTAT: setButtons(holder, Buttons.BUTTON_ON); setThermostatRowData(mDeviceInfo, holder); break; - case Domoticz.UTILITIES_TYPE_HEATING: + case DomoticzValues.Device.Utility.Type.HEATING: setButtons(holder, Buttons.SET); setTemperatureRowData(mDeviceInfo, holder); break; diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java index 648895c53..07e0a1fa6 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/SwitchesAdapter.java @@ -249,11 +249,11 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo, setButtons(holder, Buttons.BUTTON_ON); setPushOnOffSwitchRowData(mDeviceInfo, holder, true); break; - case Domoticz.UTILITIES_TYPE_THERMOSTAT: + case DomoticzValues.Device.Utility.Type.THERMOSTAT: setButtons(holder, Buttons.BUTTON_ON); setThermostatRowData(mDeviceInfo, holder); break; - case Domoticz.UTILITIES_TYPE_HEATING: + case DomoticzValues.Device.Utility.Type.HEATING: setButtons(holder, Buttons.SET); setTemperatureRowData(mDeviceInfo, holder); break; diff --git a/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java b/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java index 09462dc07..b786a02bd 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java +++ b/app/src/main/java/nl/hnogames/domoticz/Adapters/UtilityAdapter.java @@ -120,11 +120,11 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position) final UtilitiesInfo mUtilitiesInfo = filteredData.get(position); final double setPoint = mUtilitiesInfo.getSetPoint(); - if (Domoticz.UTILITIES_TYPE_THERMOSTAT.equalsIgnoreCase(mUtilitiesInfo.getType())) { + if (DomoticzValues.Device.Utility.Type.THERMOSTAT.equalsIgnoreCase(mUtilitiesInfo.getType())) { setButtons(holder, Buttons.THERMOSTAT); CreateThermostatRow(holder, mUtilitiesInfo, setPoint); } else { - if (Domoticz.UTILITIES_SUBTYPE_TEXT.equalsIgnoreCase(mUtilitiesInfo.getSubType())) { + if (DomoticzValues.Device.Utility.SubType.TEXT.equalsIgnoreCase(mUtilitiesInfo.getSubType())) { CreateTextRow(holder, mUtilitiesInfo); setButtons(holder, Buttons.TEXT); } else { diff --git a/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java b/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java index a1f7797b0..1b28d78c5 100644 --- a/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java +++ b/app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java @@ -370,19 +370,19 @@ private LineData generateData(View view) { } } - if (g.getPercentage() != null && g.getPercentage().length() > 0) { + if (g.getValue() != null && g.getValue().length() > 0) { addPercentage = true; - valuesv.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getPercentage()))); - if (g.hasPercentageRange()) { + valuesv.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getValue()))); + if (g.hasValueRange()) { addPercentageRange = true; - valuesvMin.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getPercentageMin()))); - valuesvMax.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getPercentageMax()))); + valuesvMin.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getValueMin()))); + valuesvMax.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getValueMax()))); } } - if (g.getSecondPercentage() != null && g.getSecondPercentage().length() > 0) { + if (g.getSecondValue() != null && g.getSecondValue().length() > 0) { addSecondPercentage = true; - valuesv2.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getSecondPercentage()))); + valuesv2.add(new Entry(mydate.getTimeInMillis(), Float.parseFloat(g.getSecondValue()))); } if (g.getCounter() != null && g.getCounter().length() > 0) { diff --git a/app/src/main/res/layout/dialog_graph.xml b/app/src/main/res/layout/dialog_graph.xml index 71b4a7bfe..486bd5b3b 100644 --- a/app/src/main/res/layout/dialog_graph.xml +++ b/app/src/main/res/layout/dialog_graph.xml @@ -90,7 +90,7 @@ android:id="@+id/legend_percentage" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Percentage" + android:text="Value" android:textColor="@color/material_yellow_600" android:visibility="gone" /> @@ -98,7 +98,7 @@ android:id="@+id/legend_percentage2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Percentage 2" + android:text="Value 2" android:textColor="@color/material_orange_600" android:visibility="gone" /> diff --git a/app/version.properties b/app/version.properties index 42f0e2085..3436d97e7 100644 --- a/app/version.properties +++ b/app/version.properties @@ -1,4 +1,4 @@ -#Fri Jan 20 11:53:42 CET 2017 -VERSION_BUILD=2041 -VERSION_PATCH=357 -VERSION_CODE=174 +#Fri Jan 20 14:28:48 CET 2017 +VERSION_BUILD=2066 +VERSION_PATCH=358 +VERSION_CODE=175 diff --git a/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/GraphPointInfo.java b/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/GraphPointInfo.java index 7ac9ebd9e..dddd7fa4f 100644 --- a/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/GraphPointInfo.java +++ b/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/GraphPointInfo.java @@ -39,7 +39,7 @@ public class GraphPointInfo { private float te = Float.NaN; private float ta = Float.NaN; private float tm = Float.NaN; - boolean hasTemperatureRange = true; + boolean hasTemperatureRange = false; private String eu; @@ -51,7 +51,7 @@ public class GraphPointInfo { private String vMin; private String vMax; - boolean hasPercentageRange = true; + boolean hasPercentageRange = false; private String c; private String di; @@ -137,10 +137,10 @@ public String toString() { '}'; } - public String getPercentage() { + public String getValue() { return v; } - public String getSecondPercentage() { + public String getSecondValue() { return v2; } @@ -155,13 +155,13 @@ public String getPowerUsage() { return eu; } - public String getPercentageMin() { + public String getValueMin() { return vMin; } - public String getPercentageMax() { + public String getValueMax() { return vMax; } - public boolean hasPercentageRange() { + public boolean hasValueRange() { return hasPercentageRange; } diff --git a/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Domoticz.java b/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Domoticz.java index 1c38e3b4d..85b3b3391 100644 --- a/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Domoticz.java +++ b/domoticzapi/src/main/java/nl/hnogames/domoticzapi/Domoticz.java @@ -116,9 +116,6 @@ public class Domoticz { public static final int DOMOTICZ_FAKE_ID = 99999; public static final String HIDDEN_CHARACTER = "$"; - public static final String UTILITIES_TYPE_THERMOSTAT = "Thermostat"; - public static final String UTILITIES_TYPE_HEATING = "Heating"; - public static final String UTILITIES_SUBTYPE_TEXT = "Text"; public static final String DOMOTICZ_DEFAULT_SERVER = "DEFAULT"; private static final String TAG = "DomoticzAPI"; diff --git a/domoticzapi/src/main/java/nl/hnogames/domoticzapi/DomoticzValues.java b/domoticzapi/src/main/java/nl/hnogames/domoticzapi/DomoticzValues.java index c8e75142b..025eeb7a1 100644 --- a/domoticzapi/src/main/java/nl/hnogames/domoticzapi/DomoticzValues.java +++ b/domoticzapi/src/main/java/nl/hnogames/domoticzapi/DomoticzValues.java @@ -86,6 +86,26 @@ interface Action { } } + interface Utility { + interface Type { + String HEATING = "Heating"; + String THERMOSTAT = "Thermostat"; + } + + interface SubType { + String TEXT = "Text"; + + String PERCENTAGE = "Percentage"; + String ENERGY = "Energy"; + String KWH = "kWh"; + String GAS = "Gas"; + String ELECTRIC = "Electric"; + String VOLTCRAFT = "Voltcraft"; + String SETPOINT = "SetPoint"; + String YOULESS = "YouLess"; + } + } + interface Blind { interface State { String CLOSED = "Closed"; diff --git a/domoticzapi/version.properties b/domoticzapi/version.properties index e5cf0152e..d7dc60b4e 100644 --- a/domoticzapi/version.properties +++ b/domoticzapi/version.properties @@ -1,4 +1,4 @@ -#Fri Jan 20 11:53:42 CET 2017 -VERSION_BUILD=1511 -VERSION_PATCH=46 -VERSION_CODE=46 +#Fri Jan 20 14:28:49 CET 2017 +VERSION_BUILD=1536 +VERSION_PATCH=47 +VERSION_CODE=47