Custom labels

This commit is contained in:
MM20
2022-09-11 18:42:02 +02:00
parent 29a06dfc4f
commit 7b86677fc2
18 changed files with 161 additions and 63 deletions
@@ -16,6 +16,8 @@ abstract class Searchable : Comparable<Searchable> {
abstract val key: String
abstract val label: String
var labelOverride: String? = null
open fun serialize(): String = ""
open fun getLaunchIntent(context: Context): Intent? = null
@@ -43,8 +45,10 @@ abstract class Searchable : Comparable<Searchable> {
abstract fun getPlaceholderIcon(context: Context): StaticLauncherIcon
override fun compareTo(other: Searchable): Int {
val label1 = labelOverride ?: label
val label2 = other.labelOverride ?: other.label
return Collator.getInstance().apply { strength = Collator.SECONDARY }
.compare(label.romanize(), other.label.romanize())
.compare(label1.romanize(), label2.romanize())
}
override fun equals(other: Any?): Boolean {