Implemented setting pref icon size
This commit is contained in:
parent
19fdd4cea8
commit
584b797788
|
@ -36,11 +36,15 @@ open class BankIconFinder : IBankIconFinder {
|
||||||
protected val faviconComparator = FaviconComparator(webClient)
|
protected val faviconComparator = FaviconComparator(webClient)
|
||||||
|
|
||||||
|
|
||||||
override fun findIconForBank(bankName: String): String? {
|
override fun findIconForBank(bankName: String, prefSize: Int): String? {
|
||||||
findBankWebsite(bankName)?.let { bankUrl ->
|
findBankWebsite(bankName)?.let { bankUrl ->
|
||||||
webClient.get(bankUrl).body?.let { bankHomepageResponse ->
|
webClient.get(bankUrl).body?.let { bankHomepageResponse ->
|
||||||
val favicons = faviconFinder.extractFavicons(Jsoup.parse(bankHomepageResponse), bankUrl)
|
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
|
return faviconComparator.getBestIcon(favicons, 16)?.url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package net.dankito.banking.util
|
||||||
|
|
||||||
interface IBankIconFinder {
|
interface IBankIconFinder {
|
||||||
|
|
||||||
fun findIconForBank(bankName: String): String?
|
fun findIconForBank(bankName: String, prefSize: Int = 72): String?
|
||||||
|
|
||||||
fun findBankWebsite(bankName: String): String?
|
fun findBankWebsite(bankName: String): String?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue