Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
Log conditional JFX features and only use the spinner animation if we…
Browse files Browse the repository at this point in the history
… support 3D graphics.
  • Loading branch information
mikehearn committed Dec 23, 2018
1 parent 6a3cde8 commit 3fd0ce6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions shell/src/main/kotlin/app/graviton/shell/GravitonBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package app.graviton.shell
import app.graviton.mac.configureMacWindow
import app.graviton.mac.setupMacMenuBar
import app.graviton.ui.ThreeDSpinner
import javafx.application.ConditionalFeature
import javafx.application.Platform
import javafx.geometry.Pos
import javafx.scene.Scene
import javafx.scene.effect.GaussianBlur
Expand Down Expand Up @@ -39,6 +41,16 @@ class GravitonBrowser : App(ShellView::class, Styles::class) {
}
stage.title = "Graviton"
super.start(stage)
logJFXFeatures()
}

private fun logJFXFeatures() {
val features = mutableListOf<String>()
for (feature in ConditionalFeature.values()) {
if (Platform.isSupported(feature))
features += feature.name
}
GravitonCLI.info { "JavaFX supports ${features.joinToString()}" }
}
}

Expand All @@ -48,9 +60,8 @@ class GravitonBrowser : App(ShellView::class, Styles::class) {
class ShellView : View() {
companion object : Logging()

private lateinit var spinnerAnimation: ThreeDSpinner
private var spinnerAnimation: ThreeDSpinner? = null
private val appLaunchUI: AppLaunchUI by inject()
private val loginUI: LoginUI by inject()
private lateinit var mainStackPane: StackPane
private lateinit var screenshotView: ImageView

Expand Down Expand Up @@ -117,12 +128,15 @@ class ShellView : View() {
}

private fun StackPane.createSpinnerAnimation() {
spinnerAnimation = ThreeDSpinner(art.animationColor)
spinnerAnimation.root.maxWidth = 600.0
spinnerAnimation.root.maxHeight = 600.0
spinnerAnimation.root.translateY = 0.0
children += spinnerAnimation.root
spinnerAnimation.visible.bind(isWorking)
if (Platform.isSupported(ConditionalFeature.SCENE3D)) {
val spinnerAnimation = ThreeDSpinner(art.animationColor)
spinnerAnimation.root.maxWidth = 600.0
spinnerAnimation.root.maxHeight = 600.0
spinnerAnimation.root.translateY = 0.0
children += spinnerAnimation.root
spinnerAnimation.visible.bind(isWorking)
this@ShellView.spinnerAnimation = spinnerAnimation
}
}

private fun StackPane.artVBox() {
Expand Down
2 changes: 1 addition & 1 deletion shell/src/main/kotlin/app/graviton/shell/GravitonCLI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class GravitonCLI(private val arguments: Array<String>) : Runnable {
// This will execute asynchronously, only if run from an installed package (via the bootstrapper).
startupChecks()

// TODO: Run this step async.
// TODO: Run these steps async.
setupProxies()

if (backgroundUpdate) {
Expand Down

0 comments on commit 3fd0ce6

Please sign in to comment.