move names not starting with a letter at the bottom

This commit is contained in:
tibbi 2017-12-10 19:33:26 +01:00
parent 771ecd5ec4
commit 9a376df115
2 changed files with 8 additions and 2 deletions

View File

@ -64,6 +64,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
contacts_fastscroller.updateBubbleColors()
contacts_fastscroller.allowBubbleDisplay = config.showInfoBubble
updateTextColors(contacts_holder)
}
@ -127,7 +128,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
contacts_list.adapter = this
}
contacts_fastscroller.allowBubbleDisplay = config.showInfoBubble
contacts_fastscroller.setViews(contacts_list) {
val item = contacts.getOrNull(it)
contacts_fastscroller.updateBubbleText(item?.getBubbleText() ?: "")

View File

@ -11,7 +11,13 @@ data class Contact(val id: Int, var name: String, var number: String, var photoU
override fun compareTo(other: Contact): Int {
var result = when {
(sorting and SORT_BY_NUMBER != 0) -> number.toLowerCase().compareTo(other.number.toLowerCase())
else -> name.toLowerCase().compareTo(other.name.toLowerCase())
else -> if (name.first().isLetter() && !other.name.first().isLetter()) {
-1
} else if (!name.first().isLetter() && other.name.first().isLetter()) {
1
} else {
name.toLowerCase().compareTo(other.name.toLowerCase())
}
}
if (sorting and SORT_DESCENDING != 0) {