Improve code

This commit is contained in:
ligi 2017-09-14 13:21:03 +02:00
parent 63a06fcad0
commit 0ae2b1712e
No known key found for this signature in database
GPG key ID: 8E81894010ABF23D

View file

@ -19,7 +19,7 @@ internal class SearchSuccessCallback(private val context: Context, private val p
val pass = passStore.getPassbookForId(uuid) val pass = passStore.getPassbookForId(uuid)
val isDuplicate = foundList.any { it.id.equals(uuid) } val isDuplicate = foundList.any { it.id == uuid }
if (pass != null && !isDuplicate) { if (pass != null && !isDuplicate) {
foundList.add(pass) foundList.add(pass)
val iconBitmap = pass.getBitmap(passStore, PassBitmapDefinitions.BITMAP_ICON) val iconBitmap = pass.getBitmap(passStore, PassBitmapDefinitions.BITMAP_ICON)
@ -62,7 +62,7 @@ internal class SearchSuccessCallback(private val context: Context, private val p
private fun getDateOfPassForComparison(pass: Pass): ZonedDateTime? { private fun getDateOfPassForComparison(pass: Pass): ZonedDateTime? {
if (pass.calendarTimespan != null && pass.calendarTimespan!!.from != null) { if (pass.calendarTimespan != null && pass.calendarTimespan!!.from != null) {
return pass.calendarTimespan!!.from return pass.calendarTimespan!!.from
} else if (pass.validTimespans != null && pass.validTimespans!!.size > 0 && pass.validTimespans!![0].to != null) { } else if (pass.validTimespans != null && pass.validTimespans!!.isNotEmpty() && pass.validTimespans!![0].to != null) {
return pass.validTimespans!![0].to return pass.validTimespans!![0].to
} }
return null return null