Initial commit

This commit is contained in:
MM20
2021-09-18 23:37:52 +02:00
commit 749e4e3073
938 changed files with 50475 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/build
+45
View File
@@ -0,0 +1,45 @@
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-android-extensions")
}
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 = "1.8"
}
}
dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.androidx.core)
implementation(libs.androidx.appcompat)
implementation(project(":database"))
implementation(project(":search"))
}
View File
+21
View File
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.kts.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
+5
View File
@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mm20.launcher2.hiddenitems">
/
</manifest>
@@ -0,0 +1,29 @@
package de.mm20.launcher2.hiddenitems
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import de.mm20.launcher2.database.AppDatabase
import de.mm20.launcher2.search.data.Searchable
/**
* A low level repository for hidden items. This can only be used to retrieve keys and to check
* whether an item is hidden. To retrieve actual Searchable objects, use FavoritesRepository.
*/
class HiddenItemsRepository private constructor(val context: Context) {
val hiddenItemsKeys : LiveData<List<String>> = AppDatabase.getInstance(context).searchDao().getHiddenItemKeys()
fun isHidden(item: Searchable): LiveData<Boolean> {
return AppDatabase.getInstance(context).searchDao().isHidden(item.key)
}
companion object {
private lateinit var instance: HiddenItemsRepository
fun getInstance(context: Context): HiddenItemsRepository {
if(!Companion::instance.isInitialized) instance = HiddenItemsRepository(context.applicationContext)
return instance
}
}
}
@@ -0,0 +1,9 @@
package de.mm20.launcher2.hiddenitems
import android.app.Application
import androidx.lifecycle.AndroidViewModel
class HiddenItemsViewModel(app: Application): AndroidViewModel(app) {
val hiddenItemsKeys = HiddenItemsRepository.getInstance(app).hiddenItemsKeys
}