Skip to content

Commit

Permalink
UI Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph5610 committed May 23, 2020
1 parent c10deea commit 496ee56
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/main/kotlin/online/hudacek/broadcastsfx/extension/ui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,11 @@ internal fun Node.shouldBeDisabled(station: Property<Station>) {
*/
internal fun ImageView.createImage(station: Station) {
this.image = defaultRadioLogo
logger.debug { "image of ${station.name} is from ${station.favicon}" }

if (ImageCache.isImageInCache(station)) {
this.image = ImageCache.getImageFromCache(station)
} else {
logger.debug { "trying to download image from ${station.favicon}" }

if (station.isInvalidImage()) {
logger.debug { "url is empty or unsupported, using default image" }
this.image = defaultRadioLogo
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/online/hudacek/broadcastsfx/styles/Styles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Styles : Stylesheet() {
companion object {
val playerStationInfo by cssclass()
val grayLabel by cssclass()
val noBorder by cssclass()
val libraryListView by cssclass()
val primaryButton by cssclass()
val playerControls by cssclass()
val header by cssclass()
Expand Down Expand Up @@ -95,7 +95,7 @@ class Styles : Stylesheet() {
textFill = Paint.valueOf(primaryColor)
}

noBorder {
libraryListView {
backgroundColor += Color.WHITESMOKE
unsafe("-fx-control-inner-background", Color.TRANSPARENT)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LibraryView : View() {
}
addClass(Styles.customListItem)
}
addClass(Styles.noBorder)
addClass(Styles.libraryListView)
}

private val countriesListView = listview<Countries> {
Expand All @@ -67,7 +67,7 @@ class LibraryView : View() {
addClass(Styles.customListItem)
}

addClass(Styles.noBorder)
addClass(Styles.libraryListView)
onUserSelect(1) {
libraryListView.selectionModel.clearSelection()
controller.loadLibrary(LibraryType.Country, it.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class StationsDataGridView : View() {
}

cellCache {
println(it.url_resolved)
vbox(alignment = Pos.CENTER) {
popover {
vbox {
Expand Down
12 changes: 10 additions & 2 deletions src/main/kotlin/online/hudacek/broadcastsfx/views/StationsView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ class StationsView : View() {
private val dataGrid: StationsDataGridView by inject()

private val contentTop = flowpane {
paddingBottom = 0.0
maxHeight = 10.0
style {
backgroundColor += Color.WHITESMOKE
}

add(contentName)
}

Expand Down Expand Up @@ -157,4 +155,14 @@ class StationsView : View() {
contentTop.show()
dataGrid.show(stations)
}

fun setContentName(libraryType: LibraryType, value: String? = null) {
contentName.text = when (libraryType) {
LibraryType.Favourites -> messages["favourites"]
LibraryType.History -> messages["history"]
LibraryType.TopStations -> messages["topStations"]
LibraryType.Search -> messages["searchResultsFor"] + " \"$value\""
else -> value
}
}
}

0 comments on commit 496ee56

Please sign in to comment.