From 79b0f7a7a996f898797c49082fc0116aa0c0d9db Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 6 Nov 2020 06:19:05 +0100 Subject: [PATCH] Implemented filtering out .ico for JavaFX --- .../kotlin/net/dankito/banking/util/BankIconFinder.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/BankingUiCommon/src/jvmMain/kotlin/net/dankito/banking/util/BankIconFinder.kt b/ui/BankingUiCommon/src/jvmMain/kotlin/net/dankito/banking/util/BankIconFinder.kt index 275c8418..4a92fcb3 100644 --- a/ui/BankingUiCommon/src/jvmMain/kotlin/net/dankito/banking/util/BankIconFinder.kt +++ b/ui/BankingUiCommon/src/jvmMain/kotlin/net/dankito/banking/util/BankIconFinder.kt @@ -3,6 +3,7 @@ package net.dankito.banking.util import net.dankito.utils.favicon.FaviconComparator import net.dankito.utils.favicon.FaviconFinder import net.dankito.utils.favicon.web.UrlConnectionWebClient +import net.dankito.utils.os.OsHelper import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.slf4j.LoggerFactory @@ -48,11 +49,13 @@ open class BankIconFinder : IBankIconFinder { webClient.get(bankUrl).body?.let { bankHomepageResponse -> val favicons = faviconFinder.extractFavicons(Jsoup.parse(bankHomepageResponse), bankUrl) - faviconComparator.getBestIcon(favicons, prefSize, prefSize + 32, true)?.let { prefFavicon -> + val fileTypesToExclude = if (OsHelper().isRunningOnAndroid) listOf() else listOf(".ico") // JavaFX cannot display .ico files + + faviconComparator.getBestIcon(favicons, prefSize, prefSize + 32, true, fileTypesToExclude)?.let { prefFavicon -> return prefFavicon.url } - return faviconComparator.getBestIcon(favicons, 16)?.url + return faviconComparator.getBestIcon(favicons, 16, null, true, fileTypesToExclude)?.url } }