dashboard redesign
This commit is contained in:
		
					parent
					
						
							
								bb377effea
							
						
					
				
			
			
				commit
				
					
						bb0b5086d0
					
				
			
		
					 10 changed files with 103 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -33,6 +33,7 @@ import javafx.scene.image.Image;
 | 
			
		|||
import javafx.stage.Stage;
 | 
			
		||||
 | 
			
		||||
import java.util.ResourceBundle;
 | 
			
		||||
 | 
			
		||||
import static java.util.ResourceBundle.getBundle;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -52,10 +53,12 @@ public class App extends Application {
 | 
			
		|||
        FXMLLoader loader = new FXMLLoader(
 | 
			
		||||
                App.class.getResource("fxml/Dashboard.fxml"), GENERAL_BUNDLE);
 | 
			
		||||
        Parent root = loader.load();
 | 
			
		||||
 | 
			
		||||
        stage.getIcons().add(new Image(App.class.getResource("img/icon.png").toString()));
 | 
			
		||||
        stage.setTitle("ESTRABA");
 | 
			
		||||
        stage.setTitle(GENERAL_BUNDLE.getString("app.title"));
 | 
			
		||||
        stage.setResizable(false);
 | 
			
		||||
        stage.setScene(new Scene(root));
 | 
			
		||||
        stage.setResizable(true);
 | 
			
		||||
 | 
			
		||||
        stage.show();
 | 
			
		||||
        loader.<DashboardController>getController().postinit();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -178,6 +178,8 @@ public class DashboardController implements Initializable {
 | 
			
		|||
        imgDate.setImage(new Image(App.class.getResourceAsStream("img/date.png")));
 | 
			
		||||
        imgDistance.setImage(new Image(App.class.getResourceAsStream("img/distance.png")));
 | 
			
		||||
        imgElevation.setImage(new Image(App.class.getResourceAsStream("img/elevation.png")));
 | 
			
		||||
 | 
			
		||||
        snackbar = new JFXSnackbar();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @FXML
 | 
			
		||||
| 
						 | 
				
			
			@ -199,7 +201,6 @@ public class DashboardController implements Initializable {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    public void postinit() {
 | 
			
		||||
        snackbar = new JFXSnackbar();
 | 
			
		||||
        snackbar.registerSnackbarContainer(root);
 | 
			
		||||
        try {load();} catch (JAXBException e) {e.printStackTrace();}
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -225,10 +226,10 @@ public class DashboardController implements Initializable {
 | 
			
		|||
        valueDate.setText(track.getStartTime().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)));
 | 
			
		||||
        valueTime.setText(track.getStartTime().format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM)));
 | 
			
		||||
        valueActiveTime.setText(LocalTime.MIDNIGHT.plus(track.getMovingTime())
 | 
			
		||||
                .format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM)));
 | 
			
		||||
                .format(DateTimeFormatter.ofPattern("HH:mm:ss")));
 | 
			
		||||
        valueTotalTime.setText(App.GENERAL_BUNDLE.getString("time.of")
 | 
			
		||||
                + LocalTime.MIDNIGHT.plus(track.getTotalDuration())
 | 
			
		||||
                .format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM)));
 | 
			
		||||
                .format(DateTimeFormatter.ofPattern("HH:mm:ss")));
 | 
			
		||||
 | 
			
		||||
        if (track.getTotalDistance() > KILOMETER_CUTOFF) {
 | 
			
		||||
            valueDistance.setText(String.format("%.2f", track.getTotalDistance() / 1000)
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +257,7 @@ public class DashboardController implements Initializable {
 | 
			
		|||
        // traverse the chunks
 | 
			
		||||
        ObservableList<Chunk> chunks = track.getChunks();
 | 
			
		||||
        double currentDistance = 0.0;
 | 
			
		||||
        double currentHeight = 0.0;
 | 
			
		||||
        double currentHeight = chunks.get(0).getFirstPoint().getElevation();
 | 
			
		||||
        for (Chunk chunk : chunks) {
 | 
			
		||||
            currentDistance += chunk.getDistance();
 | 
			
		||||
            if (chunk.getDistance() < DISTANCE_EPSILON) continue;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
package es.kauron.estraba.controller;
 | 
			
		||||
 | 
			
		||||
import com.jfoenix.controls.JFXButton;
 | 
			
		||||
import com.jfoenix.controls.JFXSpinner;
 | 
			
		||||
import es.kauron.estraba.App;
 | 
			
		||||
import javafx.event.ActionEvent;
 | 
			
		||||
import javafx.fxml.FXML;
 | 
			
		||||
import javafx.fxml.Initializable;
 | 
			
		||||
import javafx.scene.control.Label;
 | 
			
		||||
import javafx.scene.image.Image;
 | 
			
		||||
import javafx.scene.image.ImageView;
 | 
			
		||||
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.util.ResourceBundle;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * es.kauron.estraba.controller (estraba)
 | 
			
		||||
 * Created by baudlord on 5/19/16.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class SplashController implements Initializable{
 | 
			
		||||
 | 
			
		||||
    @FXML
 | 
			
		||||
    private ImageView imgLogo;
 | 
			
		||||
 | 
			
		||||
    @FXML
 | 
			
		||||
    private JFXSpinner spinner;
 | 
			
		||||
 | 
			
		||||
    @FXML
 | 
			
		||||
    private Label labelWelcome;
 | 
			
		||||
 | 
			
		||||
    @FXML
 | 
			
		||||
    private JFXButton buttonLoad;
 | 
			
		||||
 | 
			
		||||
    @FXML
 | 
			
		||||
    void loadGPXFile(ActionEvent event) {
 | 
			
		||||
        buttonLoad.setVisible(false);
 | 
			
		||||
        labelWelcome.setVisible(false);
 | 
			
		||||
        spinner.setVisible(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void initialize(URL location, ResourceBundle resources) {
 | 
			
		||||
        imgLogo.setImage(new Image(App.class.getResourceAsStream("img/splash.png")));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								src/main/resources/es/kauron/estraba/css/palette.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/main/resources/es/kauron/estraba/css/palette.css
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
/* Palette generated by Material Palette - materialpalette.com/deep-orange/indigo */
 | 
			
		||||
 | 
			
		||||
.background            { -fx-background-color: #FFFFFF; }
 | 
			
		||||
.dark-primary-color    { -fx-background-color: #E64A19; }
 | 
			
		||||
.default-primary-color { -fx-background-color: #FF5722; }
 | 
			
		||||
.light-primary-color   { -fx-background-color: #FFCCBC; }
 | 
			
		||||
.text-primary-color    { -fx-text-fill: #FFFFFF; }
 | 
			
		||||
.accent-color          { -fx-background-color: #536DFE; }
 | 
			
		||||
.primary-text-color    { -fx-text-fill: #212121; }
 | 
			
		||||
.secondary-text-color  { -fx-text-fill: #727272; }
 | 
			
		||||
.divider-color         { -fx-background-color: #B6B6B6; }
 | 
			
		||||
							
								
								
									
										27
									
								
								src/main/resources/es/kauron/estraba/fxml/Splash.fxml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								src/main/resources/es/kauron/estraba/fxml/Splash.fxml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
 | 
			
		||||
<?import com.jfoenix.controls.JFXButton?>
 | 
			
		||||
<?import com.jfoenix.controls.JFXSpinner?>
 | 
			
		||||
<?import javafx.geometry.Insets?>
 | 
			
		||||
<?import javafx.scene.control.Label?>
 | 
			
		||||
<?import javafx.scene.image.ImageView?>
 | 
			
		||||
<?import javafx.scene.layout.AnchorPane?>
 | 
			
		||||
<?import javafx.scene.layout.StackPane?>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="300.0" styleClass="background" stylesheets="@../css/palette.css" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.estraba.controller.SplashController">
 | 
			
		||||
      <ImageView fx:id="imgLogo" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="25.0">
 | 
			
		||||
      </ImageView>
 | 
			
		||||
      <JFXSpinner fx:id="spinner" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
 | 
			
		||||
      <Label fx:id="labelWelcome" alignment="CENTER" text="%label.welcome" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
 | 
			
		||||
      <StackPane layoutX="-1.0" layoutY="251.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
 | 
			
		||||
            <JFXButton maxHeight="-Infinity" maxWidth="-Infinity" onAction="#loadGPXFile" styleClass="accent-color" text="%label.loadGPX">
 | 
			
		||||
               <padding>
 | 
			
		||||
                  <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
 | 
			
		||||
               </padding>
 | 
			
		||||
               <StackPane.margin>
 | 
			
		||||
                  <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
 | 
			
		||||
               </StackPane.margin>
 | 
			
		||||
            </JFXButton>
 | 
			
		||||
      </StackPane>
 | 
			
		||||
</AnchorPane>
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								src/main/resources/es/kauron/estraba/ttf/DAGGERSQUARE.otf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/main/resources/es/kauron/estraba/ttf/DAGGERSQUARE.otf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
app.title=ESTRABA
 | 
			
		||||
label.cadence=Cadence
 | 
			
		||||
label.distance=Distance
 | 
			
		||||
label.elevation=Elevation
 | 
			
		||||
| 
						 | 
				
			
			@ -8,10 +9,10 @@ tab.dashboard=Dashboard
 | 
			
		|||
tab.graph=Stats
 | 
			
		||||
tab.map=Your Route
 | 
			
		||||
tab.settings=Settings
 | 
			
		||||
time.of=of
 | 
			
		||||
time.of=of\ 
 | 
			
		||||
unit.bpm=\ bpm
 | 
			
		||||
unit.hz=\ Hz
 | 
			
		||||
unit.km=km
 | 
			
		||||
unit.km=\ km
 | 
			
		||||
unit.kmph=\ kmph
 | 
			
		||||
unit.m=\ m
 | 
			
		||||
zone.anaerobic=Anaerobic
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
app.title=ESTRABA
 | 
			
		||||
label.cadence=Cadencia
 | 
			
		||||
label.distance=Distancia
 | 
			
		||||
label.elevation=Elevacion
 | 
			
		||||
| 
						 | 
				
			
			@ -8,10 +9,10 @@ tab.dashboard=Sumari
 | 
			
		|||
tab.graph=Estad\u00edstiques
 | 
			
		||||
tab.map=La teva ruta
 | 
			
		||||
tab.settings=Ajustos
 | 
			
		||||
time.of=de
 | 
			
		||||
time.of=de\ 
 | 
			
		||||
unit.bpm=\ ppm
 | 
			
		||||
unit.hz=\ Hz
 | 
			
		||||
unit.km=km
 | 
			
		||||
unit.km=\ km
 | 
			
		||||
unit.kmph=\ km/h
 | 
			
		||||
unit.m=\ m
 | 
			
		||||
zone.anaerobic=Anaer\u00f2bic
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
app.title=ESTRABA
 | 
			
		||||
label.cadence=Cadencia
 | 
			
		||||
label.distance=Distancia
 | 
			
		||||
label.elevation=Elevacion
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +12,7 @@ tab.settings=Ajustes
 | 
			
		|||
time.of=de
 | 
			
		||||
unit.bpm=\ ppm
 | 
			
		||||
unit.hz=\ Hz
 | 
			
		||||
unit.km=km
 | 
			
		||||
unit.km=\ km
 | 
			
		||||
unit.kmph=\ km/h
 | 
			
		||||
unit.m=\ m
 | 
			
		||||
zone.anaerobic=Anaer\u00f3bico
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue