kauron/estraba
Archived
1
0
Fork 0

dashboard redesign

This commit is contained in:
Jesús Vélez Palacios 2016-05-19 11:22:11 +02:00
parent cf481771b7
commit bb377effea
5 changed files with 71 additions and 47 deletions

View file

@ -2,6 +2,7 @@ package es.kauron.estraba.controller;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXSnackbar; import com.jfoenix.controls.JFXSnackbar;
import com.lynden.gmapsfx.GoogleMapView;
import es.kauron.estraba.App; import es.kauron.estraba.App;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
@ -122,8 +123,8 @@ public class DashboardController implements Initializable {
@FXML @FXML
private Tab tabMap; private Tab tabMap;
//@FXML @FXML
//private GoogleMapView mapView; private GoogleMapView mapView;
@FXML @FXML
private JFXButton elevationButton; private JFXButton elevationButton;
@ -160,6 +161,7 @@ public class DashboardController implements Initializable {
private JFXSnackbar snackbar; private JFXSnackbar snackbar;
private final double DISTANCE_EPSILON = 10; private final double DISTANCE_EPSILON = 10;
private final double KILOMETER_CUTOFF = 10000;
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
@ -180,7 +182,6 @@ public class DashboardController implements Initializable {
@FXML @FXML
private void onMapButton(ActionEvent event){ private void onMapButton(ActionEvent event){
mapChart.getData().clear();
switch (((JFXButton)event.getSource()).getId()) { switch (((JFXButton)event.getSource()).getId()) {
case "elevationButton": case "elevationButton":
mapChart.setData(elevationChart.getData()); mapChart.setData(elevationChart.getData());
@ -229,8 +230,13 @@ public class DashboardController implements Initializable {
+ LocalTime.MIDNIGHT.plus(track.getTotalDuration()) + LocalTime.MIDNIGHT.plus(track.getTotalDuration())
.format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM))); .format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM)));
valueDistance.setText(track.getTotalDistance() if (track.getTotalDistance() > KILOMETER_CUTOFF) {
+ App.GENERAL_BUNDLE.getString("unit.m")); valueDistance.setText(String.format("%.2f", track.getTotalDistance() / 1000)
+ App.GENERAL_BUNDLE.getString("unit.km"));
} else {
valueDistance.setText(String.format("%.2f", track.getTotalDistance())
+ App.GENERAL_BUNDLE.getString("unit.m"));
}
valueElevation.setText((int)(track.getTotalAscent() - track.getTotalDescend()) valueElevation.setText((int)(track.getTotalAscent() - track.getTotalDescend())
+ App.GENERAL_BUNDLE.getString("unit.m")); + App.GENERAL_BUNDLE.getString("unit.m"));
@ -252,7 +258,6 @@ public class DashboardController implements Initializable {
double currentDistance = 0.0; double currentDistance = 0.0;
double currentHeight = 0.0; double currentHeight = 0.0;
for (Chunk chunk : chunks) { for (Chunk chunk : chunks) {
System.err.println(chunk.getDistance());
currentDistance += chunk.getDistance(); currentDistance += chunk.getDistance();
if (chunk.getDistance() < DISTANCE_EPSILON) continue; if (chunk.getDistance() < DISTANCE_EPSILON) continue;
currentHeight += chunk.getAscent() - chunk.getDescend(); currentHeight += chunk.getAscent() - chunk.getDescend();
@ -264,11 +269,11 @@ public class DashboardController implements Initializable {
cadenceChartData.getData().add(new XYChart.Data<>(currentDistance, chunk.getAvgCadence())); cadenceChartData.getData().add(new XYChart.Data<>(currentDistance, chunk.getAvgCadence()));
String zone; String zone;
if (chunk.getAvgHeartRate() > 170) zone = "Zone 4"; if (chunk.getAvgHeartRate() > 170) zone = App.GENERAL_BUNDLE.getString("zone.anaerobic");
else if (chunk.getAvgHeartRate() > 150) zone = "Zone 3"; else if (chunk.getAvgHeartRate() > 150) zone = App.GENERAL_BUNDLE.getString("zone.threshold");
else if (chunk.getAvgHeartRate() > 130) zone = "Zone 2"; else if (chunk.getAvgHeartRate() > 130) zone = App.GENERAL_BUNDLE.getString("zone.tempo");
else if (chunk.getAvgHeartRate() > 110) zone = "Zone 1"; else if (chunk.getAvgHeartRate() > 110) zone = App.GENERAL_BUNDLE.getString("zone.endurance");
else zone = "Zone 0"; else zone = App.GENERAL_BUNDLE.getString("zone.recovery");
boolean pieFound = false; boolean pieFound = false;
for (PieChart.Data d : zoneChart.getData()){ for (PieChart.Data d : zoneChart.getData()){

View file

@ -2,6 +2,7 @@
<?import com.jfoenix.controls.JFXButton?> <?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTabPane?> <?import com.jfoenix.controls.JFXTabPane?>
<?import com.lynden.gmapsfx.GoogleMapView?>
<?import java.lang.String?> <?import java.lang.String?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.chart.AreaChart?> <?import javafx.scene.chart.AreaChart?>
@ -61,7 +62,7 @@
<String fx:value=".estraba.dashboard.label.HR" /> <String fx:value=".estraba.dashboard.label.HR" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueHRAvg" alignment="CENTER" maxWidth="1.7976931348623157E308" text="92 bpm" textAlignment="CENTER"> <Label fx:id="valueHRAvg" alignment="CENTER" maxWidth="1.7976931348623157E308" textAlignment="CENTER">
<font> <font>
<Font size="30.0" /> <Font size="30.0" />
</font> </font>
@ -72,7 +73,7 @@
</styleClass> </styleClass>
</Label> </Label>
<HBox> <HBox>
<Label fx:id="valueHRMin" alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" text="60bpm" HBox.hgrow="ALWAYS"> <Label fx:id="valueHRMin" alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -85,7 +86,7 @@
<String fx:value=".estraba.dashboard.value.minhr" /> <String fx:value=".estraba.dashboard.value.minhr" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueHRMax" layoutX="10.0" layoutY="10.0" maxWidth="1.7976931348623157E308" text="100bpm" HBox.hgrow="ALWAYS"> <Label fx:id="valueHRMax" layoutX="10.0" layoutY="10.0" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -118,7 +119,7 @@
<String fx:value=".estraba.dashboard.label.HR" /> <String fx:value=".estraba.dashboard.label.HR" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueSpeedAvg" alignment="CENTER" maxWidth="1.7976931348623157E308" text="35 Km/h" textAlignment="CENTER"> <Label fx:id="valueSpeedAvg" alignment="CENTER" maxWidth="1.7976931348623157E308" textAlignment="CENTER">
<font> <font>
<Font size="30.0" /> <Font size="30.0" />
</font> </font>
@ -128,7 +129,7 @@
<String fx:value=".estraba.dashboard.value.avgspeed" /> <String fx:value=".estraba.dashboard.value.avgspeed" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueSpeedMax" alignment="CENTER" maxWidth="1.7976931348623157E308" text="56 Km/h"> <Label fx:id="valueSpeedMax" alignment="CENTER" maxWidth="1.7976931348623157E308">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -160,7 +161,7 @@
<String fx:value=".estraba.dashboard.label.HR" /> <String fx:value=".estraba.dashboard.label.HR" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueCadenceAvg" alignment="CENTER" maxWidth="1.7976931348623157E308" text="90 Hz" textAlignment="CENTER"> <Label fx:id="valueCadenceAvg" alignment="CENTER" maxWidth="1.7976931348623157E308" textAlignment="CENTER">
<font> <font>
<Font size="30.0" /> <Font size="30.0" />
</font> </font>
@ -170,7 +171,7 @@
<String fx:value=".estraba.dashboard.value.avgcadence" /> <String fx:value=".estraba.dashboard.value.avgcadence" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueCadenceMax" alignment="CENTER" maxWidth="1.7976931348623157E308" text="152 Hz"> <Label fx:id="valueCadenceMax" alignment="CENTER" maxWidth="1.7976931348623157E308">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -191,7 +192,7 @@
<VBox layoutX="15.0" layoutY="15.0" minHeight="360.0" minWidth="300.0" prefHeight="300.0"> <VBox layoutX="15.0" layoutY="15.0" minHeight="360.0" minWidth="300.0" prefHeight="300.0">
<HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS"> <HBox alignment="CENTER" layoutX="10.0" layoutY="10.0" minHeight="-Infinity" minWidth="-Infinity" prefHeight="90.0" prefWidth="200.0" HBox.hgrow="ALWAYS" VBox.vgrow="ALWAYS">
<VBox alignment="CENTER" HBox.hgrow="ALWAYS"> <VBox alignment="CENTER" HBox.hgrow="ALWAYS">
<Label fx:id="valueDate" alignment="CENTER" layoutX="10.0" layoutY="97.0" maxWidth="1.7976931348623157E308" text="Wednesday, 18 May 2016"> <Label fx:id="valueDate" alignment="CENTER" layoutX="10.0" layoutY="97.0" maxWidth="1.7976931348623157E308">
<padding> <padding>
<Insets left="5.0" right="5.0" top="5.0" /> <Insets left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -206,7 +207,7 @@
<Insets /> <Insets />
</VBox.margin> </VBox.margin>
</Label> </Label>
<Label fx:id="valueTime" alignment="CENTER" layoutX="10.0" layoutY="30.0" maxWidth="1.7976931348623157E308" text="17:00:14"> <Label fx:id="valueTime" alignment="CENTER" layoutX="10.0" layoutY="30.0" maxWidth="1.7976931348623157E308">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" />
</padding> </padding>
@ -218,7 +219,7 @@
<String fx:value=".estraba.dashboard.value.sub" /> <String fx:value=".estraba.dashboard.value.sub" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueActiveTime" alignment="CENTER" maxWidth="1.7976931348623157E308" text="4:37:42" textAlignment="CENTER"> <Label fx:id="valueActiveTime" alignment="CENTER" maxWidth="1.7976931348623157E308" textAlignment="CENTER">
<font> <font>
<Font size="30.0" /> <Font size="30.0" />
</font> </font>
@ -228,7 +229,7 @@
<String fx:value=".estraba.dashboard.value.activetime" /> <String fx:value=".estraba.dashboard.value.activetime" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueTotalTime" alignment="CENTER" maxWidth="1.7976931348623157E308" text="of 5:00:00"> <Label fx:id="valueTotalTime" alignment="CENTER" maxWidth="1.7976931348623157E308">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -260,7 +261,7 @@
<String fx:value=".estraba.dashboard.label.HR" /> <String fx:value=".estraba.dashboard.label.HR" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueDistance" alignment="CENTER" maxWidth="1.7976931348623157E308" text="46714 m" textAlignment="CENTER"> <Label fx:id="valueDistance" alignment="CENTER" maxWidth="1.7976931348623157E308" textAlignment="CENTER">
<font> <font>
<Font size="30.0" /> <Font size="30.0" />
</font> </font>
@ -289,7 +290,7 @@
<String fx:value=".estraba.dashboard.label.HR" /> <String fx:value=".estraba.dashboard.label.HR" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueElevation" alignment="CENTER" maxWidth="1.7976931348623157E308" text="3166 m" textAlignment="CENTER"> <Label fx:id="valueElevation" alignment="CENTER" maxWidth="1.7976931348623157E308" textAlignment="CENTER">
<font> <font>
<Font size="30.0" /> <Font size="30.0" />
</font> </font>
@ -300,7 +301,7 @@
</styleClass> </styleClass>
</Label> </Label>
<HBox> <HBox>
<Label fx:id="valueAscent" alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" text="+ 2053m" HBox.hgrow="ALWAYS"> <Label fx:id="valueAscent" alignment="CENTER_RIGHT" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -313,7 +314,7 @@
<String fx:value=".estraba.dashboard.value.ascent" /> <String fx:value=".estraba.dashboard.value.ascent" />
</styleClass> </styleClass>
</Label> </Label>
<Label fx:id="valueDescent" layoutX="10.0" layoutY="10.0" maxWidth="1.7976931348623157E308" text="- 1113 m" HBox.hgrow="ALWAYS"> <Label fx:id="valueDescent" layoutX="10.0" layoutY="10.0" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS">
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
@ -353,7 +354,7 @@
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
<!-- <GoogleMapView fx:id="mapView"/> --> <GoogleMapView fx:id="mapView" VBox.vgrow="ALWAYS" />
<HBox maxHeight="-Infinity" minHeight="-Infinity" prefHeight="128.0"> <HBox maxHeight="-Infinity" minHeight="-Infinity" prefHeight="128.0">
<VBox> <VBox>
<JFXButton fx:id="elevationButton" minHeight="-Infinity" minWidth="-Infinity" onAction="#onMapButton" prefHeight="32.0" prefWidth="32.0"> <JFXButton fx:id="elevationButton" minHeight="-Infinity" minWidth="-Infinity" onAction="#onMapButton" prefHeight="32.0" prefWidth="32.0">
@ -389,7 +390,7 @@
</VBox.margin> </VBox.margin>
</JFXButton> </JFXButton>
</VBox> </VBox>
<LineChart fx:id="mapChart" HBox.hgrow="ALWAYS"> <LineChart fx:id="mapChart" animated="false" createSymbols="false" legendVisible="false" HBox.hgrow="ALWAYS">
<xAxis> <xAxis>
<NumberAxis side="BOTTOM" /> <NumberAxis side="BOTTOM" />
</xAxis> </xAxis>
@ -405,7 +406,7 @@
<padding> <padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding> </padding>
<AreaChart fx:id="elevationChart" minHeight="100.0"> <AreaChart fx:id="elevationChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis> <xAxis>
<NumberAxis side="BOTTOM" /> <NumberAxis side="BOTTOM" />
</xAxis> </xAxis>
@ -413,7 +414,7 @@
<NumberAxis side="LEFT" /> <NumberAxis side="LEFT" />
</yAxis> </yAxis>
</AreaChart> </AreaChart>
<LineChart fx:id="speedChart" minHeight="100.0"> <LineChart fx:id="speedChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis> <xAxis>
<NumberAxis /> <NumberAxis />
</xAxis> </xAxis>
@ -421,7 +422,7 @@
<NumberAxis side="LEFT" /> <NumberAxis side="LEFT" />
</yAxis> </yAxis>
</LineChart> </LineChart>
<LineChart fx:id="hrChart" minHeight="100.0"> <LineChart fx:id="hrChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis> <xAxis>
<NumberAxis side="BOTTOM" /> <NumberAxis side="BOTTOM" />
</xAxis> </xAxis>
@ -429,7 +430,7 @@
<NumberAxis side="LEFT" /> <NumberAxis side="LEFT" />
</yAxis> </yAxis>
</LineChart> </LineChart>
<LineChart fx:id="cadenceChart" minHeight="100.0"> <LineChart fx:id="cadenceChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis> <xAxis>
<NumberAxis side="BOTTOM" /> <NumberAxis side="BOTTOM" />
</xAxis> </xAxis>

View file

@ -11,5 +11,11 @@ tab.settings=Settings
time.of=of time.of=of
unit.bpm=\ bpm unit.bpm=\ bpm
unit.hz=\ Hz unit.hz=\ Hz
unit.km=km
unit.kmph=\ kmph unit.kmph=\ kmph
unit.m=\ m unit.m=\ m
zone.anaerobic=Anaerobic
zone.endurance=Endurance
zone.recovery=Recovery
zone.tempo=Tempo
zone.threshold=Threshold

View file

@ -1,15 +1,21 @@
label.cadence=Cadència label.cadence=Cadencia
label.distance=Distancia label.distance=Distancia
label.elevation=Elevació label.elevation=Elevacion
label.hr=Pulsacions label.hr=YOLO
label.motivation=¡Benvinguts! label.motivation=\u00a1Benvinguts!
label.speed=Velocitat label.speed=Speed
tab.dashboard=Sumari tab.dashboard=Sumari
tab.graph=Estadístiques tab.graph=Estad\u00edstiques
tab.map=La teua ruta tab.map=La teva ruta
tab.settings=Configuració tab.settings=Ajustos
time.of=de time.of=de
unit.bpm=\ ppm unit.bpm=\ ppm
unit.hz=\ Hz unit.hz=\ Hz
unit.km=km
unit.kmph=\ km/h unit.kmph=\ km/h
unit.m=\ m unit.m=\ m
zone.anaerobic=Anaer\u00f2bic
zone.endurance=Resist\u00e8ncia
zone.recovery=Recuperaci\u00f3
zone.tempo=Tempo
zone.threshold=Llindar

View file

@ -1,15 +1,21 @@
label.cadence=Cadencia label.cadence=Cadencia
label.distance=Distancia label.distance=Distancia
label.elevation=Elevacion label.elevation=Elevacion
label.hr=Pulsaciónes label.hr=Pulsaci\u00f3nes
label.motivation=¡Bienvenido! label.motivation=\u00a1Bienvenido!
label.speed=Velocidad label.speed=Velocidad
tab.dashboard=Resumen tab.dashboard=Res\u00famen
tab.graph=Estadísticas tab.graph=Estad\u00edsticas
tab.map=Tu ruta tab.map=Tu ruta
tab.settings=Ajustes tab.settings=Ajustes
time.of=de time.of=de
unit.bpm=\ ppm unit.bpm=\ ppm
unit.hz=\ Hz unit.hz=\ Hz
unit.km=km
unit.kmph=\ km/h unit.kmph=\ km/h
unit.m=\ m unit.m=\ m
zone.anaerobic=Anaer\u00f3bico
zone.endurance=Resistencia
zone.recovery=Recuperaci\u00f3n
zone.tempo=Tempo
zone.threshold=Umbral