Implemented setting pref icon size

This commit is contained in:
dankito 2020-04-27 01:11:28 +02:00
parent 19fdd4cea8
commit 584b797788
2 changed files with 6 additions and 2 deletions

View File

@ -36,11 +36,15 @@ open class BankIconFinder : IBankIconFinder {
protected val faviconComparator = FaviconComparator(webClient)
override fun findIconForBank(bankName: String): String? {
override fun findIconForBank(bankName: String, prefSize: Int): String? {
findBankWebsite(bankName)?.let { bankUrl ->
webClient.get(bankUrl).body?.let { bankHomepageResponse ->
val favicons = faviconFinder.extractFavicons(Jsoup.parse(bankHomepageResponse), bankUrl)
faviconComparator.getBestIcon(favicons, prefSize, prefSize + 32, true)?.let { prefFavicon ->
return prefFavicon.url
}
return faviconComparator.getBestIcon(favicons, 16)?.url
}
}

View File

@ -3,7 +3,7 @@ package net.dankito.banking.util
interface IBankIconFinder {
fun findIconForBank(bankName: String): String?
fun findIconForBank(bankName: String, prefSize: Int = 72): String?
fun findBankWebsite(bankName: String): String?