remove unused code

This commit is contained in:
MM20 2022-10-16 14:21:07 +02:00
parent fcd3e3c3ac
commit 7e6a4466ca
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 0 additions and 48 deletions

View File

@ -1,12 +0,0 @@
package de.mm20.launcher2.ui.launcher.search
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class SearchBarVM: ViewModel() {
val focused = MutableLiveData(false)
fun setFocused(focused :Boolean) {
this.focused.value = focused
}
}

View File

@ -214,40 +214,4 @@ class SearchVM : ViewModel(), KoinComponent {
}
}
}
private inline fun <reified T : PinnableSearchable> Flow<List<T>>.withCustomAttributeResults(
customAttributeResults: Flow<List<PinnableSearchable>>
): Flow<List<T>> {
return this.combine(customAttributeResults) { items, items2 ->
(items + items2.filterIsInstance<T>()).distinctBy { it.key }
}
}
private suspend fun <T : PinnableSearchable> Flow<List<T>>.collectWithHiddenItems(
hiddenItemKeys: Flow<List<String>>,
action: (items: List<T>, hidden: List<T>) -> Unit
) {
return collectLatest { items ->
hiddenItemKeys.collectLatest { hiddenKeys ->
val (results, hidden) = items.partition { !hiddenKeys.contains(it.key) }
action(results, hidden)
}
}
}
private fun <T : PinnableSearchable> Flow<List<T>>.sorted(): Flow<List<T>> = this.map { it.sorted() }
}
private data class HiddenItemResults(
val apps: List<LauncherApp> = emptyList(),
val contacts: List<Contact> = emptyList(),
val calendarEvents: List<CalendarEvent> = emptyList(),
val files: List<File> = emptyList(),
val appShortcuts: List<AppShortcut> = emptyList(),
) {
fun joinToList(): List<PinnableSearchable> {
return apps + contacts + calendarEvents + files + appShortcuts
}
}