Skip to content

Commit

Permalink
Add logo
Browse files Browse the repository at this point in the history
  • Loading branch information
neworld committed May 8, 2017
1 parent af0c0c3 commit 27f9d33
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
4 changes: 3 additions & 1 deletion app/src/assets/climber_timer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ color_of_warning_time=FF0000
sound_start=sounds/start.wav
sound_last_minute=sounds/minute.wav
sound_last_seconds=sounds/ding.wav
sound_finish=sounds/finish.wav
sound_finish=sounds/finish.wav

logo=logo.png
Binary file added app/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/src/main/java/lt/neworld/climbtimer/AppProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ object AppProperties {
private const val PROP_SOUND_LAST_SECONDS = "sound_last_seconds"
private const val PROP_SOUND_FINISH = "sound_finish"

private const val PROP_LOGO = "logo"

private val file = File("climber_timer.properties")

private val properties by lazy {
Expand Down Expand Up @@ -60,6 +62,8 @@ object AppProperties {
var soundLastSeconds: File? by FileField(PROP_SOUND_LAST_SECONDS, null)
var soundFinish: File? by FileField(PROP_SOUND_FINISH, null)

var logo: File? by FileField(PROP_LOGO, null)

class TimeField(key: String, default: Long) : Field<Long>(key, default) {
override fun deserialize(raw: String): Long = raw.toLong() * 1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import javafx.fxml.Initializable
import javafx.scene.Parent
import javafx.scene.Scene
import javafx.scene.control.Label
import javafx.scene.image.Image
import javafx.scene.image.ImageView
import javafx.scene.input.KeyCode
import javafx.scene.paint.Color
import javafx.stage.Stage
Expand All @@ -30,6 +32,9 @@ class TimerController : Initializable {
@FXML
private lateinit var title: Label

@FXML
private lateinit var logo: ImageView

private val timer = Timer(
runTime = AppProperties.runTime,
waitTime = AppProperties.waitTime,
Expand All @@ -39,6 +44,7 @@ class TimerController : Initializable {

override fun initialize(location: URL, resources: ResourceBundle?) {
title.text = AppProperties.title
logo.image = AppProperties.logo?.let { Image(it.toURI().toString()) }
showTimer()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.text.Font?>

Expand All @@ -17,13 +18,23 @@
</Label>
</center>
<top>
<Label fx:id="title" text="Montis Magia" textFill="WHITE" wrapText="true" BorderPane.alignment="CENTER">
<font>
<Font size="96.0" />
</font>
<padding>
<Insets left="50.0" right="50.0" />
</padding>
</Label>
<BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<center>
<Label fx:id="title" text="Montis Magia" textFill="WHITE" wrapText="true" BorderPane.alignment="CENTER">
<font>
<Font size="96.0" />
</font>
<padding>
<Insets left="50.0" right="50.0" />
</padding>
</Label>
</center>
<left>
<ImageView fx:id="logo" fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" BorderPane.alignment="CENTER" />
</left>
<right>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" BorderPane.alignment="CENTER" />
</right>
</BorderPane>
</top>
</BorderPane>

0 comments on commit 27f9d33

Please sign in to comment.