Remove unused appsearch module
This commit is contained in:
parent
42c1ec3ce1
commit
0193d4e495
@ -115,7 +115,6 @@ dependencies {
|
|||||||
implementation(libs.koin.android)
|
implementation(libs.koin.android)
|
||||||
|
|
||||||
implementation(project(":applications"))
|
implementation(project(":applications"))
|
||||||
implementation(project(":appsearch"))
|
|
||||||
implementation(project(":badges"))
|
implementation(project(":badges"))
|
||||||
implementation(project(":base"))
|
implementation(project(":base"))
|
||||||
implementation(project(":calculator"))
|
implementation(project(":calculator"))
|
||||||
|
|||||||
1
appsearch/.gitignore
vendored
1
appsearch/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("com.android.library")
|
|
||||||
id("kotlin-android")
|
|
||||||
id("kotlin-kapt")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdk = sdk.versions.compileSdk.get().toInt()
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdk = sdk.versions.minSdk.get().toInt()
|
|
||||||
targetSdk = sdk.versions.targetSdk.get().toInt()
|
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles("consumer-rules.pro")
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
isMinifyEnabled = false
|
|
||||||
proguardFiles(
|
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
||||||
"proguard-rules.pro"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(libs.bundles.kotlin)
|
|
||||||
implementation(libs.androidx.core)
|
|
||||||
implementation(libs.androidx.appcompat)
|
|
||||||
|
|
||||||
implementation(libs.bundles.androidx.lifecycle)
|
|
||||||
|
|
||||||
implementation(libs.bundles.androidx.appsearch)
|
|
||||||
kapt(libs.androidx.appsearchcompiler)
|
|
||||||
|
|
||||||
implementation(libs.guava)
|
|
||||||
|
|
||||||
implementation(libs.koin.android)
|
|
||||||
|
|
||||||
implementation(project(":search"))
|
|
||||||
implementation(project(":base"))
|
|
||||||
implementation(project(":icons"))
|
|
||||||
implementation(project(":preferences"))
|
|
||||||
implementation(project(":ktx"))
|
|
||||||
implementation(project(":badges"))
|
|
||||||
implementation(project(":hiddenitems"))
|
|
||||||
}
|
|
||||||
21
appsearch/proguard-rules.pro
vendored
21
appsearch/proguard-rules.pro
vendored
@ -1,21 +0,0 @@
|
|||||||
# Add project specific ProGuard rules here.
|
|
||||||
# You can control the set of applied configuration files using the
|
|
||||||
# proguardFiles setting in build.gradle.kts.
|
|
||||||
#
|
|
||||||
# For more details, see
|
|
||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
||||||
|
|
||||||
# If your project uses WebView with JS, uncomment the following
|
|
||||||
# and specify the fully qualified class name to the JavaScript interface
|
|
||||||
# class:
|
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
||||||
# public *;
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Uncomment this to preserve the line number information for
|
|
||||||
# debugging stack traces.
|
|
||||||
#-keepattributes SourceFile,LineNumberTable
|
|
||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
|
||||||
# hide the original source file name.
|
|
||||||
#-renamesourcefileattribute SourceFile
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="de.mm20.launcher2.appsearch">
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
package de.mm20.launcher2.appsearch
|
|
||||||
|
|
||||||
import android.app.appsearch.AppSearchManager
|
|
||||||
import android.app.appsearch.GlobalSearchSession
|
|
||||||
import android.app.appsearch.SearchResult
|
|
||||||
import android.app.appsearch.SearchSpec
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.MediatorLiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
import de.mm20.launcher2.hiddenitems.HiddenItemsRepository
|
|
||||||
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
|
||||||
import de.mm20.launcher2.search.BaseSearchableRepository
|
|
||||||
import de.mm20.launcher2.search.data.AppSearchResult
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.util.concurrent.Executors
|
|
||||||
import kotlin.coroutines.suspendCoroutine
|
|
||||||
|
|
||||||
class AppSearchRepository(
|
|
||||||
val context: Context,
|
|
||||||
hiddenItemsRepository: HiddenItemsRepository
|
|
||||||
) : BaseSearchableRepository() {
|
|
||||||
|
|
||||||
private var session: GlobalSearchSession? = null
|
|
||||||
|
|
||||||
val appSearchResults = MediatorLiveData<List<AppSearchResult>?>()
|
|
||||||
|
|
||||||
private val allAppSearchResults = MutableLiveData<List<AppSearchResult>?>(emptyList())
|
|
||||||
private val hiddenItemKeys = hiddenItemsRepository.hiddenItemsKeys
|
|
||||||
|
|
||||||
init {
|
|
||||||
appSearchResults.addSource(hiddenItemKeys) { keys ->
|
|
||||||
appSearchResults.value = allAppSearchResults.value?.filter { !keys.contains(it.key) }
|
|
||||||
}
|
|
||||||
appSearchResults.addSource(allAppSearchResults) { c ->
|
|
||||||
appSearchResults.value = c?.filter { hiddenItemKeys.value?.contains(it.key) != true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun search(query: String) {
|
|
||||||
val results = emptyList<AppSearchResult>()
|
|
||||||
if (!isAtLeastApiLevel(31)) return
|
|
||||||
val executor = Executors.newSingleThreadExecutor()
|
|
||||||
if (session == null) {
|
|
||||||
val appSearchManager = context.getSystemService(AppSearchManager::class.java)
|
|
||||||
session = suspendCoroutine { cont ->
|
|
||||||
appSearchManager.createGlobalSearchSession(executor) {
|
|
||||||
cont.resumeWith(Result.success(it.resultValue))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val searchResults = session?.search(query, SearchSpec.Builder().build())
|
|
||||||
val page = suspendCoroutine<List<SearchResult>?> { cont ->
|
|
||||||
searchResults?.getNextPage(executor) {
|
|
||||||
cont.resumeWith(Result.success(it.resultValue))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
allAppSearchResults.value = results
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package de.mm20.launcher2.appsearch
|
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import androidx.lifecycle.AndroidViewModel
|
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import de.mm20.launcher2.search.data.AppSearchResult
|
|
||||||
|
|
||||||
class AppSearchViewModel(
|
|
||||||
appSearchRepository: AppSearchRepository
|
|
||||||
) : ViewModel() {
|
|
||||||
private val appSearch: LiveData<List<AppSearchResult>?> = appSearchRepository.appSearchResults
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
package de.mm20.launcher2.appsearch
|
|
||||||
|
|
||||||
import org.koin.android.ext.koin.androidContext
|
|
||||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
|
||||||
import org.koin.dsl.module
|
|
||||||
|
|
||||||
val appSearchModule = module {
|
|
||||||
single { AppSearchRepository(androidContext(), get()) }
|
|
||||||
viewModel { AppSearchViewModel(get()) }
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package de.mm20.launcher2.search.data
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import de.mm20.launcher2.icons.LauncherIcon
|
|
||||||
|
|
||||||
class AppSearchResult: Searchable() {
|
|
||||||
override val key: String
|
|
||||||
get() = TODO("Not yet implemented")
|
|
||||||
override val label: String
|
|
||||||
get() = TODO("Not yet implemented")
|
|
||||||
|
|
||||||
override fun getPlaceholderIcon(context: Context): LauncherIcon {
|
|
||||||
TODO("Not yet implemented")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -386,5 +386,4 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
include(":appsearch")
|
|
||||||
include(":notifications")
|
include(":notifications")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user