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

View file

@ -2,6 +2,7 @@
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTabPane?>
<?import com.lynden.gmapsfx.GoogleMapView?>
<?import java.lang.String?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.chart.AreaChart?>
@ -61,7 +62,7 @@
<String fx:value=".estraba.dashboard.label.HR" />
</styleClass>
</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 size="30.0" />
</font>
@ -72,7 +73,7 @@
</styleClass>
</Label>
<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>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -85,7 +86,7 @@
<String fx:value=".estraba.dashboard.value.minhr" />
</styleClass>
</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>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -118,7 +119,7 @@
<String fx:value=".estraba.dashboard.label.HR" />
</styleClass>
</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 size="30.0" />
</font>
@ -128,7 +129,7 @@
<String fx:value=".estraba.dashboard.value.avgspeed" />
</styleClass>
</Label>
<Label fx:id="valueSpeedMax" alignment="CENTER" maxWidth="1.7976931348623157E308" text="56 Km/h">
<Label fx:id="valueSpeedMax" alignment="CENTER" maxWidth="1.7976931348623157E308">
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -160,7 +161,7 @@
<String fx:value=".estraba.dashboard.label.HR" />
</styleClass>
</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 size="30.0" />
</font>
@ -170,7 +171,7 @@
<String fx:value=".estraba.dashboard.value.avgcadence" />
</styleClass>
</Label>
<Label fx:id="valueCadenceMax" alignment="CENTER" maxWidth="1.7976931348623157E308" text="152 Hz">
<Label fx:id="valueCadenceMax" alignment="CENTER" maxWidth="1.7976931348623157E308">
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -191,7 +192,7 @@
<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">
<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>
<Insets left="5.0" right="5.0" top="5.0" />
</padding>
@ -206,7 +207,7 @@
<Insets />
</VBox.margin>
</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>
<Insets bottom="5.0" left="5.0" right="5.0" />
</padding>
@ -218,7 +219,7 @@
<String fx:value=".estraba.dashboard.value.sub" />
</styleClass>
</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 size="30.0" />
</font>
@ -228,7 +229,7 @@
<String fx:value=".estraba.dashboard.value.activetime" />
</styleClass>
</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>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -260,7 +261,7 @@
<String fx:value=".estraba.dashboard.label.HR" />
</styleClass>
</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 size="30.0" />
</font>
@ -289,7 +290,7 @@
<String fx:value=".estraba.dashboard.label.HR" />
</styleClass>
</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 size="30.0" />
</font>
@ -300,7 +301,7 @@
</styleClass>
</Label>
<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>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -313,7 +314,7 @@
<String fx:value=".estraba.dashboard.value.ascent" />
</styleClass>
</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>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
@ -353,7 +354,7 @@
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
<!-- <GoogleMapView fx:id="mapView"/> -->
<GoogleMapView fx:id="mapView" VBox.vgrow="ALWAYS" />
<HBox maxHeight="-Infinity" minHeight="-Infinity" prefHeight="128.0">
<VBox>
<JFXButton fx:id="elevationButton" minHeight="-Infinity" minWidth="-Infinity" onAction="#onMapButton" prefHeight="32.0" prefWidth="32.0">
@ -389,7 +390,7 @@
</VBox.margin>
</JFXButton>
</VBox>
<LineChart fx:id="mapChart" HBox.hgrow="ALWAYS">
<LineChart fx:id="mapChart" animated="false" createSymbols="false" legendVisible="false" HBox.hgrow="ALWAYS">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>
@ -405,7 +406,7 @@
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
<AreaChart fx:id="elevationChart" minHeight="100.0">
<AreaChart fx:id="elevationChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>
@ -413,7 +414,7 @@
<NumberAxis side="LEFT" />
</yAxis>
</AreaChart>
<LineChart fx:id="speedChart" minHeight="100.0">
<LineChart fx:id="speedChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis>
<NumberAxis />
</xAxis>
@ -421,7 +422,7 @@
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<LineChart fx:id="hrChart" minHeight="100.0">
<LineChart fx:id="hrChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>
@ -429,7 +430,7 @@
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
<LineChart fx:id="cadenceChart" minHeight="100.0">
<LineChart fx:id="cadenceChart" createSymbols="false" legendVisible="false" minHeight="100.0">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>

View file

@ -11,5 +11,11 @@ tab.settings=Settings
time.of=of
unit.bpm=\ bpm
unit.hz=\ Hz
unit.km=km
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.elevation=Elevació
label.hr=Pulsacions
label.motivation=¡Benvinguts!
label.speed=Velocitat
label.elevation=Elevacion
label.hr=YOLO
label.motivation=\u00a1Benvinguts!
label.speed=Speed
tab.dashboard=Sumari
tab.graph=Estadístiques
tab.map=La teua ruta
tab.settings=Configuració
tab.graph=Estad\u00edstiques
tab.map=La teva ruta
tab.settings=Ajustos
time.of=de
unit.bpm=\ ppm
unit.hz=\ Hz
unit.km=km
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.distance=Distancia
label.elevation=Elevacion
label.hr=Pulsaciónes
label.motivation=¡Bienvenido!
label.hr=Pulsaci\u00f3nes
label.motivation=\u00a1Bienvenido!
label.speed=Velocidad
tab.dashboard=Resumen
tab.graph=Estadísticas
tab.dashboard=Res\u00famen
tab.graph=Estad\u00edsticas
tab.map=Tu ruta
tab.settings=Ajustes
time.of=de
unit.bpm=\ ppm
unit.hz=\ Hz
unit.km=km
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