avoid showing the same color multiple times at the caldav event type color picker

This commit is contained in:
tibbi 2018-05-04 16:15:03 +02:00
parent 7ed33a2157
commit 0f97ce7153
1 changed files with 4 additions and 1 deletions

View File

@ -182,12 +182,15 @@ class CalDAVHandler(val context: Context) {
colors.put(colorKey, color)
} while (cursor.moveToNext())
}
} catch (e: Exception) {
Log.e("DEBUG", "exc $e")
} finally {
cursor?.close()
}
val sortedColors = ArrayList<Int>(colors.size())
var sortedColors = ArrayList<Int>(colors.size())
(0 until colors.size()).mapTo(sortedColors) { colors[it] }
sortedColors = sortedColors.distinct() as ArrayList<Int>
return sortedColors
}