Further search result design adjustments
This commit is contained in:
@@ -29,6 +29,10 @@ import org.apache.commons.text.similarity.FuzzyScore
|
||||
import java.util.Locale
|
||||
|
||||
interface AppRepository : SearchableRepository<Application> {
|
||||
fun findOne(
|
||||
packageName: String,
|
||||
user: UserHandle,
|
||||
): Flow<Application?>
|
||||
fun findMany(): Flow<ImmutableList<Application>>
|
||||
}
|
||||
|
||||
@@ -195,6 +199,17 @@ internal class AppRepositoryImpl(
|
||||
return LauncherApp(context, launcherActivityInfo)
|
||||
}
|
||||
|
||||
override fun findOne(
|
||||
packageName: String,
|
||||
user: UserHandle,
|
||||
): Flow<Application?> {
|
||||
return installedApps.map {
|
||||
it.firstOrNull {
|
||||
it.componentName.packageName == packageName && it.user == user
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun findMany(): Flow<ImmutableList<Application>> {
|
||||
return installedApps.map { it.toImmutableList() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user