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

View File

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