Reorganize and group modules
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -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 {
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
namespace = "de.mm20.launcher2.compat"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.materialcomponents.core)
|
||||
}
|
||||
Vendored
+21
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</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?
|
||||
)
|
||||
Reference in New Issue
Block a user