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
+42
View File
@@ -0,0 +1,42 @@
plugins {
id("com.android.library")
id("kotlin-android")
}
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.androidx.core)
implementation(libs.androidx.appcompat)
implementation(libs.materialcomponents)
}
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.
#
# 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 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mm20.launcher2.compat">
</manifest>
@@ -0,0 +1,33 @@
package de.mm20.launcher2.compat
import android.content.pm.PackageManager
import android.os.Build
object PackageManagerCompat {
fun getInstallSource(
packageManager: PackageManager,
packageName: String
): InstallSourceInfoCompat {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val installSourceInfo = packageManager.getInstallSourceInfo(packageName)
return InstallSourceInfoCompat(
originatingPackageName = installSourceInfo.originatingPackageName,
initiatingPackageName = installSourceInfo.initiatingPackageName,
installingPackageName = installSourceInfo.installingPackageName,
)
} else {
val installerPackageName = packageManager.getInstallerPackageName(packageName)
return InstallSourceInfoCompat(
originatingPackageName = installerPackageName,
initiatingPackageName = installerPackageName,
installingPackageName = installerPackageName
)
}
}
}
data class InstallSourceInfoCompat(
val originatingPackageName: String?,
val initiatingPackageName: String?,
val installingPackageName: String?
)