Skip to content

Commit

Permalink
Fix on Graph percentage
Browse files Browse the repository at this point in the history
Fix on Graph percentage
  • Loading branch information
galadril committed Jan 20, 2017
1 parent 0fc3605 commit 129557a
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/nl/hnogames/domoticz/Fragments/Graph.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@
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" />

<TextView
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" />

Expand Down
8 changes: 4 additions & 4 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -137,10 +137,10 @@ public String toString() {
'}';
}

public String getPercentage() {
public String getValue() {
return v;
}
public String getSecondPercentage() {
public String getSecondValue() {
return v2;
}

Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions domoticzapi/version.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 129557a

Please sign in to comment.