--- a/build.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/build.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -31,7 +31,7 @@
// some extra properties
-extra["compileSdkInt"] = 31
+extra["compileSdkInt"] = 33
allprojects {
repositories {
--- a/buildSrc/build.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/build.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -28,27 +28,39 @@
version = "1.0"
+kotlin{
+ sourceSets {
+ all {
+ languageSettings {
+ optIn("kotlin.RequiresOptIn")
+ }
+ }
+ }
+}
repositories {
- gradlePluginPortal()
+ google {
+ content {
+ includeGroupByRegex("""android\.arch\..*""")
+ includeGroupByRegex("""androidx\..*""")
+ includeGroupByRegex("""com\.android\..*""")
+ includeGroupByRegex("""com\.google\..*""")
+ includeGroup("com.crashlytics.sdk.android")
+ includeGroup("io.fabric.sdk.android")
+ includeGroup("org.chromium.net")
+ includeGroup("zipflinger")
+ includeGroup("com.android")
+ }
+ }
mavenCentral()
- google()
- maven {
- // Workaround for genymotion plugin not working on gradle 5.0
- // we publish 1.4.2 version with fixes
- url = uri("https://raw.githubusercontent.com/fbarthelery/genymotion-gradle-plugin/master/repo/")
- }
- maven {
- url = uri("https://kotlin.bintray.com/kotlinx")
- }
+ gradlePluginPortal()
}
dependencies {
- implementation("com.android.tools.build:gradle:7.0.2")
- implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.71")
- implementation("com.genymotion:plugin:1.4.2")
- implementation("gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0")
- implementation("com.github.triplet.gradle:play-publisher:2.7.2")
+ implementation("com.android.tools.build:gradle:7.3.1")
+ implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
+ implementation("gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1")
+ implementation("com.github.triplet.gradle:play-publisher:3.7.0")
- implementation("com.geekorum.gradle.avdl:plugin:0.0.2")
- implementation("com.geekorum.gradle.avdl:flydroid:0.0.2")
+ implementation("com.geekorum.gradle.avdl:plugin:0.0.3")
+ implementation("com.geekorum.gradle.avdl:flydroid:0.0.3")
}
--- a/buildSrc/src/main/kotlin/AndroidJavaVersion.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/AndroidJavaVersion.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -21,6 +21,8 @@
*/
package com.geekorum.build
+import com.android.build.api.dsl.CommonExtension
+import com.android.build.api.dsl.DefaultConfig
import com.android.build.gradle.BaseExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
@@ -31,9 +33,15 @@
/**
* Configure java version compile options based on minSdkVersion value
*/
+@Suppress("UNCHECKED_CAST")
fun BaseExtension.configureJavaVersion() {
- val api = defaultConfig.minSdkVersion?.apiLevel ?: 0
+ (this as CommonExtension<*, *, DefaultConfig, *>).configureJavaVersion()
+}
+
+fun CommonExtension<*, *, DefaultConfig, *>.configureJavaVersion() {
+ val api = defaultConfig.minSdk ?: 1
val version = when {
+ api >= 30 -> JavaVersion.VERSION_11
api >= 24 -> JavaVersion.VERSION_1_8
api >= 19 -> JavaVersion.VERSION_1_7
else -> JavaVersion.VERSION_1_6
@@ -51,7 +59,7 @@
}
/**
- * Add missing annotation processord dependencies to build on Java 11
+ * Add missing annotation processor dependencies to build on Java 11
*/
fun Project.configureAnnotationProcessorDeps() {
dependencies {
@@ -62,11 +70,8 @@
add(name, "com.sun.xml.bind:jaxb-core:2.3.0.1")
add(name, "com.sun.xml.bind:jaxb-impl:2.3.2")
}
+
"annotationProcessor" -> add(name, "javax.xml.bind:jaxb-api:2.3.1")
- // I guess that on AGP 4.x+ testAnnotationProcessor inherit from annotationProcessor
- // not on 3.6.x
- "testAnnotationProcessor" -> add(name, "javax.xml.bind:jaxb-api:2.3.1")
- "androidTestAnnotationProcessor" -> add(name, "javax.xml.bind:jaxb-api:2.3.1")
}
}
}
--- a/buildSrc/src/main/kotlin/AndroidPlayStorePublisher.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/AndroidPlayStorePublisher.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -41,10 +41,10 @@
internal fun Project.configureAndroidPlayStorePublisher(): Unit {
apply(plugin = "com.github.triplet.play")
configure<PlayPublisherExtension> {
- defaultToAppBundles = true
- serviceAccountCredentials = file(properties["PLAY_STORE_JSON_KEY_FILE"]!!)
- track = properties.getOrDefault("PLAY_STORE_TRACK", "internal") as String
- fromTrack = properties.getOrDefault("PLAY_STORE_FROM_TRACK", "internal") as String
+ defaultToAppBundles.set(true)
+ track.set(properties.getOrDefault("PLAY_STORE_TRACK", "internal") as String)
+ fromTrack.set(properties.getOrDefault("PLAY_STORE_FROM_TRACK", "internal") as String)
+ serviceAccountCredentials.set(file(properties["PLAY_STORE_JSON_KEY_FILE"]!!))
}
val android = the<AppExtension>() as ExtensionAware
@@ -53,7 +53,7 @@
register("publishToGooglePlayStore") {
group = "Continuous Delivery"
description = "Publish project to Google play store"
- dependsOn(named("publish"))
+ dependsOn(named("publishApps"))
}
// only there for consistent naming scheme
--- a/buildSrc/src/main/kotlin/AndroidSigning.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/AndroidSigning.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -21,16 +21,22 @@
*/
package com.geekorum.build
-import com.android.build.gradle.BaseExtension
+import com.android.build.api.dsl.*
import org.gradle.api.Project
+private typealias AppExtensionWithSigning = CommonExtension<*, ApplicationBuildType, *, *>
+private typealias LibExtensionWithSigning = CommonExtension<*, LibraryBuildType, *, *>
+private typealias TestExtensionWithSigning = CommonExtension<*, TestBuildType, *, *>
+
+// TODO This implicitly supports only the AppPlugin
+// should we support other android plugins: LibraryPlugin TestPlugin ?
internal fun Project.configureReleaseSigningConfig() {
val releaseStoreFile = findProperty("RELEASE_STORE_FILE") as? String ?: ""
val releaseStorePassword = findProperty("RELEASE_STORE_PASSWORD") as? String ?: ""
val releaseKeyAlias= findProperty("RELEASE_KEY_ALIAS") as? String ?: ""
val releaseKeyPassword= findProperty("RELEASE_KEY_PASSWORD") as? String ?: ""
- extensions.configure<BaseExtension>("android") {
+ extensions.configure<AppExtensionWithSigning>("android") {
signingConfigs {
register("release") {
storeFile = file(releaseStoreFile)
--- a/buildSrc/src/main/kotlin/AndroidTests.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/AndroidTests.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -21,6 +21,8 @@
*/
package com.geekorum.build
+import com.android.build.api.dsl.CommonExtension
+import com.android.build.api.dsl.DefaultConfig
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.internal.dsl.TestOptions
import org.gradle.api.Project
@@ -34,17 +36,19 @@
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.kotlin
-const val espressoVersion = "3.2.0"
-const val androidxTestRunnerVersion = "1.3.0-alpha05"
-const val androidxTestCoreVersion = "1.3.0-alpha05"
-const val robolectricVersion = "4.6.1"
+const val espressoVersion = "3.5.0-alpha07" // alpha for this bug https://github.com/robolectric/robolectric/issues/6593
+const val androidxTestRunnerVersion = "1.4.0"
+const val androidxTestCoreVersion = "1.4.0"
+const val robolectricVersion = "4.8.2"
+private typealias BaseExtension = CommonExtension<*, *, DefaultConfig, *>
/*
* Configuration for espresso and robolectric usage in an Android project
*/
+@Suppress("UnstableApiUsage")
internal fun Project.configureTests() {
- extensions.configure<BaseExtension> {
+ extensions.configure<BaseExtension>("android") {
defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments += mapOf(
@@ -57,9 +61,9 @@
execution = "ANDROIDX_TEST_ORCHESTRATOR"
animationsDisabled = true
- unitTests(closureOf<TestOptions.UnitTestOptions> {
+ unitTests {
isIncludeAndroidResources = true
- })
+ }
}
}
@@ -88,8 +92,8 @@
dualTestImplementation("androidx.test.ext:truth:1.3.0-alpha01")
// mock
- testImplementation("io.mockk:mockk:1.12.0")
- androidTestImplementation("io.mockk:mockk-android:1.12.0")
+ testImplementation("io.mockk:mockk:1.13.2")
+ androidTestImplementation("io.mockk:mockk-android:1.13.2")
testImplementation("org.robolectric:robolectric:$robolectricVersion")
constraints {
--- a/buildSrc/src/main/kotlin/Avdl.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/Avdl.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -46,6 +46,34 @@
fun Project.configureAvdlDevices(flydroidUrl: String, flydroidKey: String) {
apply<FlydroidPlugin>()
+ // as FlydroidPlugin add some repositories to look for dependencies
+ // the repositories set in settings.gradle.kts via dependencyResolutionManagement
+ // are ignored because we are in mode PREFER_PROJECT
+ // to fix that we add the missing repository here too
+ repositories { // this mirror contents in settings.gradle.kts
+ google {
+ content {
+ includeGroupByRegex("""android\.arch\..*""")
+ includeGroupByRegex("""androidx\..*""")
+ includeGroupByRegex("""com\.android\..*""")
+ includeGroupByRegex("""com\.google\..*""")
+ includeGroup("com.crashlytics.sdk.android")
+ includeGroup("io.fabric.sdk.android")
+ includeGroup("org.chromium.net")
+ includeGroup("zipflinger")
+ includeGroup("com.android")
+ }
+ }
+ mavenCentral()
+ // for geekdroid
+ flatDir {
+ dirs("$rootDir/libs")
+ }
+ maven {
+ url = uri("https://jitpack.io")
+ }
+
+ }
val oneInstrumentedTestService = gradle.sharedServices.registerIfAbsent(
"oneInstrumentedTest", OneInstrumentedTestService::class.java) {
maxParallelUsages.set(1)
@@ -57,12 +85,12 @@
configure<AvdlExtension> {
devices {
android.testVariants.all {
- register("android-n-${project.path}-$baseName") {
+ register("android-p-${project.path}-$baseName") {
setup = flydroid {
url = flydroidUrl
this.flydroidKey = flydroidKey
// android-q images fail, don't manage to start the tests
- image = "android-n"
+ image = "android-p"
useTunnel = true
}
}
@@ -75,7 +103,7 @@
var lastTestTask: TaskProvider<out Task>? = null
android.testVariants.all {
val (startTask, stopTask ) =
- registerAvdlDevicesTaskForVariant(this, listOf("android-n-${project.path}-$baseName"))
+ registerAvdlDevicesTaskForVariant(this, listOf("android-p-${project.path}-$baseName"))
listOf(startTask, stopTask).forEach {
it.configure {
usesService(oneInstrumentedTestService)
--- a/buildSrc/src/main/kotlin/Repositories.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/Repositories.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/buildSrc/src/main/kotlin/RepositoryChangeset.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/RepositoryChangeset.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -21,23 +21,35 @@
*/
package com.geekorum.build
+import com.android.build.api.variant.ApplicationAndroidComponentsExtension
+import com.android.build.api.variant.BuildConfigField
+import com.android.build.api.variant.VariantOutputConfiguration.OutputType
+import org.gradle.api.DefaultTask
import org.gradle.api.Project
+import org.gradle.api.file.RegularFileProperty
+import org.gradle.api.provider.Property
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.OutputFile
+import org.gradle.api.tasks.TaskAction
+import org.gradle.configurationcache.extensions.capitalized
+import org.gradle.kotlin.dsl.register
+import org.gradle.process.ExecOperations
+import java.io.ByteArrayOutputStream
import java.io.File
-import java.io.IOException
-import java.util.concurrent.TimeUnit
-
-internal fun Project.getGitSha1(): String? = runCommand("git rev-parse HEAD", workingDir = projectDir)?.trim()
-
-internal fun Project.getHgSha1(): String? = runCommand("hg id --debug -i -r .", workingDir = projectDir)?.trim()
+import javax.inject.Inject
-internal fun Project.getHgLocalRevisionNumber(): String? = runCommand("hg id -n -r .", workingDir = projectDir)?.trim()
+internal fun ExecOperations.getGitSha1(projectDir: File): String? = runCommand("git rev-parse HEAD", workingDir = projectDir)?.trim()
+
+internal fun ExecOperations.getHgSha1(projectDir: File): String? = runCommand("hg id --debug -i -r .", workingDir = projectDir)?.trim()
+
+internal fun ExecOperations.getHgLocalRevisionNumber(projectDir: File): String? = runCommand("hg id -n -r .", workingDir = projectDir)?.trim()
-fun Project.getChangeSet(): String {
- val git = rootProject.file(".git")
- val hg = rootProject.file(".hg")
+private fun ExecOperations.getChangeSet(projectDir: File): String {
+ val git = File(projectDir, ".git")
+ val hg = File(projectDir, ".hg")
return when {
- git.exists() -> "git:${getGitSha1()}"
- hg.exists() -> "hg:${getHgSha1()}"
+ git.exists() -> "git:${getGitSha1(projectDir)}"
+ hg.exists() -> "hg:${getHgSha1(projectDir)}"
else -> "unknown"
}
}
@@ -47,27 +59,98 @@
* M is major, mm is minor, P is patch
* BBB is build version number from hg
*/
-fun Project.computeChangesetVersionCode(major: Int = 0, minor: Int = 0, patch: Int = 0): Int {
+private fun ExecOperations.computeChangesetVersionCode(projectDir: File, major: Int = 0, minor: Int = 0, patch: Int = 0): Int {
val base = (major * 1000000) + (minor * 10000) + (patch * 1000)
- return base + (getHgLocalRevisionNumber()?.trim()?.toIntOrNull() ?: 0)
+ return base + (getHgLocalRevisionNumber(projectDir)?.trim()?.toIntOrNull() ?: 0)
+}
+
+private fun ExecOperations.runCommand(
+ command: String,
+ workingDir: File = File(".")
+): String? {
+ val output = ByteArrayOutputStream()
+ val result = exec {
+ commandLine(command.split("\\s".toRegex()))
+ setWorkingDir(workingDir)
+ setStandardOutput(output)
+ setErrorOutput(output)
+ }
+ result.rethrowFailure()
+ return output.toString(Charsets.UTF_8)
}
-private fun Project.runCommand(
- command: String,
- workingDir: File = File("."),
- timeoutAmount: Long = 60,
- timeoutUnit: TimeUnit = TimeUnit.MINUTES
-): String? {
- return try {
- ProcessBuilder(*command.split("\\s".toRegex()).toTypedArray())
- .directory(workingDir)
- .redirectOutput(ProcessBuilder.Redirect.PIPE)
- .redirectError(ProcessBuilder.Redirect.PIPE)
- .start().apply {
- waitFor(timeoutAmount, timeoutUnit)
- }.inputStream.bufferedReader().readText()
- } catch (e: IOException) {
- logger.info("Unable to run command", e)
- null
+abstract class VersionCodeTask : DefaultTask() {
+
+ @get:OutputFile
+ abstract val versionCodeOutputFile: RegularFileProperty
+
+ @get:OutputFile
+ abstract val changesetOutputFile: RegularFileProperty
+
+ @get:Input
+ abstract val repositoryDirectory: Property<String>
+
+ @get:Input
+ abstract val major: Property<Int>
+
+ @get:Input
+ abstract val minor: Property<Int>
+
+ @get:Input
+ abstract val patch: Property<Int>
+
+ @get:Inject
+ abstract val exec: ExecOperations
+
+ @TaskAction
+ fun computeVersionCode() {
+ val projectDir = File(repositoryDirectory.get())
+ val versionCode = exec.computeChangesetVersionCode(projectDir, major.getOrElse(0), minor.getOrElse(0), patch.getOrElse(0))
+ versionCodeOutputFile.get().asFile.writeText("$versionCode")
+ }
+
+ @TaskAction
+ fun computeChangeset() {
+ val projectDir = File(repositoryDirectory.get())
+ val changeset = exec.getChangeSet(projectDir)
+ changesetOutputFile.get().asFile.writeText(changeset)
}
}
+
+/**
+ * @param versionNameSuffix extra string to add to version name
+ */
+fun ApplicationAndroidComponentsExtension.configureVersionChangeset(project: Project, major: Int, minor: Int, patch: Int, versionNameSuffix: String = "") {
+ // Note: Everything in there is incubating.
+
+ // onVariantProperties registers an action that configures variant properties during
+ // variant computation (which happens during afterEvaluate)
+ onVariants {
+ // Because app module can have multiple output when using mutli-APK, versionCode/Name
+ // are only available on the variant output.
+ // Here gather the output when we are in single mode (ie no multi-apk)
+ val mainOutput = it.outputs.single { it.outputType == OutputType.SINGLE }
+
+ // create version Code generating task
+ val versionCodeTask = project.tasks.register<VersionCodeTask>("computeVersionCodeFor${it.name.capitalized()}") {
+ this.major.set(major)
+ this.minor.set(minor)
+ this.patch.set(patch)
+ repositoryDirectory.set(project.rootDir.absolutePath)
+ versionCodeOutputFile.set(project.layout.buildDirectory.file("intermediates/versionCode.txt"))
+ changesetOutputFile.set(project.layout.buildDirectory.file("intermediates/changeset.txt"))
+ }
+
+ // wire version code from the task output
+ // map will create a lazy Provider that
+ // 1. runs just before the consumer(s), ensuring that the producer (VersionCodeTask) has run
+ // and therefore the file is created.
+ // 2. contains task dependency information so that the consumer(s) run after the producer.
+ mainOutput.versionCode.set(versionCodeTask.map { it.versionCodeOutputFile.get().asFile.readText().toInt() })
+ mainOutput.versionName.set("$major.$minor.$patch$versionNameSuffix")
+
+ it.buildConfigFields.put("REPOSITORY_CHANGESET", versionCodeTask.map {
+ BuildConfigField("String", "\"${it.changesetOutputFile.get().asFile.readText()}\"", "Repository changeset")
+ })
+ }
+}
--- a/buildSrc/src/main/kotlin/SourceLicenseChecker.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/SourceLicenseChecker.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -21,48 +21,145 @@
*/
package com.geekorum.build
+import com.android.build.api.dsl.AndroidSourceSet
+import com.android.build.gradle.BaseExtension
+import com.android.build.gradle.DynamicFeaturePlugin
import com.hierynomus.gradle.license.LicenseBasePlugin
import com.hierynomus.gradle.license.tasks.LicenseCheck
import com.hierynomus.gradle.license.tasks.LicenseFormat
+import nl.javadude.gradle.plugins.license.License
import nl.javadude.gradle.plugins.license.LicenseExtension
import nl.javadude.gradle.plugins.license.LicensePlugin
+import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.kotlin.dsl.apply
-import org.gradle.kotlin.dsl.configure
-import org.gradle.kotlin.dsl.invoke
-import org.gradle.kotlin.dsl.named
+import org.gradle.api.file.FileTree
+import org.gradle.api.tasks.TaskProvider
+import org.gradle.kotlin.dsl.*
+import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
+import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper
+import org.jetbrains.kotlin.gradle.plugin.KotlinJsPluginWrapper
+import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
+import java.util.*
-internal fun Project.configureSourceLicenseChecker(): Unit {
+internal fun Project.configureSourceLicenseChecker() {
apply<LicensePlugin>()
configure<LicenseExtension> {
header = file("$rootDir/config/license/header.txt")
- // ignore failures for now until we set the final license
- ignoreFailures = true
+ mapping("java", "SLASHSTAR_STYLE")
+ mapping("kt", "SLASHSTAR_STYLE")
excludes(listOf("**/*.webp", "**/*.png"))
}
- tasks {
- val checkKotlinFilesLicenseTask = register("checkKotlinFilesLicense", LicenseCheck::class.java) {
- source = fileTree("src").apply {
- include("**/*.kt")
- }
- }
+ // the LicensePlugin doesn't configure itself properly on DynamicFeaturePlugin
+ // Copied the code to configure it
+ plugins.withType(DynamicFeaturePlugin::class.java) {
+ configureAndroid()
+ }
+ // make the license tasks looks for kotlin files in an Android project
+ plugins.withType(KotlinAndroidPluginWrapper::class.java) {
+ configureKotlinAndroid()
+ }
+
+ // make the license tasks for kotlin js project
+ plugins.withType(KotlinJsPluginWrapper::class.java) {
+ configureKotlin()
+ }
+
+ plugins.withType(KotlinMultiplatformPluginWrapper::class.java) {
+ configureKotlin()
+ }
+}
- val formatKotlinFilesLicenseTask = register("formatKotlinFilesLicense", LicenseFormat::class.java) {
- source = fileTree("src").apply {
- include("**/*.kt")
- }
+@OptIn(ExperimentalStdlibApi::class)
+private fun Project.configureKotlin() {
+ val kotlin = the<KotlinProjectExtension>()
+ val taskInfix = ""
+ kotlin.sourceSets.configureEach {
+ val kotlinSource = this
+ val sourceSetTaskName =
+ "${LicenseBasePlugin.getLICENSE_TASK_BASE_NAME()}${taskInfix}${name.capitalize(Locale.ROOT)}"
+ logger.info("Adding $sourceSetTaskName task for sourceSet ${kotlinSource.name}")
+ if (sourceSetTaskName in tasks.names) {
+ // tasks may have already been added by configuration for the Android plugin
+ logger.info("Tasks $sourceSetTaskName already exists. Skip")
+ return@configureEach
}
-
- named<Task>(LicenseBasePlugin.getLICENSE_TASK_BASE_NAME()) {
- dependsOn(checkKotlinFilesLicenseTask)
+ tasks.register(sourceSetTaskName, LicenseCheck::class.java) {
+ source(kotlinSource.kotlin)
}
-
- named<Task>(LicenseBasePlugin.getFORMAT_TASK_BASE_NAME()) {
- dependsOn(formatKotlinFilesLicenseTask)
+ val sourceSetFormatTaskName =
+ "${LicenseBasePlugin.getFORMAT_TASK_BASE_NAME()}${taskInfix}${name.capitalize(Locale.ROOT)}"
+ tasks.register(sourceSetFormatTaskName, LicenseFormat::class.java) {
+ source(kotlinSource.kotlin)
}
}
}
+
+@OptIn(ExperimentalStdlibApi::class)
+private fun Project.configureKotlinAndroid() {
+ val kotlin = the<KotlinProjectExtension>()
+ val android = the<BaseExtension>()
+ val taskInfix = "Android"
+ android.sourceSets.configureEach {
+ val kotlinSource = kotlin.sourceSets[name]
+ logger.info("Adding kotlin sources from sourceSet $name to License plugin tasks")
+ val sourceSetTaskName =
+ "${LicenseBasePlugin.getLICENSE_TASK_BASE_NAME()}${taskInfix}${name.capitalize(Locale.ROOT)}"
+ tasks.named(sourceSetTaskName, LicenseCheck::class.java) {
+ source(kotlinSource.kotlin, manifest.srcFile)
+ }
+ val sourceSetFormatTaskName =
+ "${LicenseBasePlugin.getFORMAT_TASK_BASE_NAME()}${taskInfix}${name.capitalize(Locale.ROOT)}"
+ tasks.named(sourceSetFormatTaskName, LicenseFormat::class.java) {
+ source(kotlinSource.kotlin, manifest.srcFile)
+ }
+ }
+}
+
+
+private fun Project.configureAndroid() {
+ val android = the<BaseExtension>()
+ configureSourceSetRule(android.sourceSets, "Android") { ss ->
+ @Suppress("DEPRECATION")
+ when (ss) {
+ // the dsl.AndroidSourceSet don't expose any getter, so we still need to cast it
+ is com.android.build.gradle.api.AndroidSourceSet -> {
+ ss.java.getSourceFiles() + ss.res.getSourceFiles() + fileTree(ss.manifest.srcFile)
+ }
+ else -> fileTree()
+ }
+ }
+}
+
+/**
+ * Dynamically create a task for each sourceSet, and register with check
+ */
+@Suppress("DefaultLocale")
+private fun Project.configureSourceSetRule(androidSourceSetContainer: NamedDomainObjectContainer<out AndroidSourceSet>,
+ taskInfix: String, sourceSetSources: (AndroidSourceSet) -> FileTree) {
+ // This follows the other check task pattern
+ androidSourceSetContainer.configureEach {
+ val sourceSetTaskName = "${LicenseBasePlugin.getLICENSE_TASK_BASE_NAME()}${taskInfix}${name.capitalize()}"
+ logger.info("Adding $sourceSetTaskName task for sourceSet $name")
+
+ val checkTask = tasks.register(sourceSetTaskName, LicenseCheck::class.java)
+ configureForSourceSet(this, checkTask, sourceSetSources)
+
+ // Add independent license task, which will perform format
+ val sourceSetFormatTaskName = "${LicenseBasePlugin.getFORMAT_TASK_BASE_NAME()}${taskInfix}${name.capitalize()}"
+ val formatTask = tasks.register(sourceSetFormatTaskName, LicenseFormat::class.java)
+ configureForSourceSet(this, formatTask, sourceSetSources)
+ }
+}
+
+private fun configureForSourceSet(sourceSet: AndroidSourceSet, task: TaskProvider<out License>, sourceSetSources: (AndroidSourceSet) -> FileTree) {
+ task.configure {
+ // Explicitly set description
+ description = "Scanning license on ${sourceSet.name} files"
+
+ // Default to all source files from SourceSet
+ source = sourceSetSources(sourceSet)
+ }
+}
--- a/buildSrc/src/main/kotlin/VersionAlignment.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/VersionAlignment.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/buildSrc/src/main/kotlin/android-avdl.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/android-avdl.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/buildSrc/src/main/kotlin/android-signing.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/android-signing.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/buildSrc/src/main/kotlin/android-tests.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/android-tests.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/buildSrc/src/main/kotlin/play-store-publish.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/play-store-publish.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/buildSrc/src/main/kotlin/source-license-checker.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/buildSrc/src/main/kotlin/source-license-checker.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/config/android-checkstyle.gradle Sat Dec 11 00:24:26 2021 -0400
+++ b/config/android-checkstyle.gradle Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/config/android-maven-publication.gradle Sat Dec 11 00:24:26 2021 -0400
+++ b/config/android-maven-publication.gradle Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/config/java-checkstyle.gradle Sat Dec 11 00:24:26 2021 -0400
+++ b/config/java-checkstyle.gradle Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/config/license/header.txt Sat Dec 11 00:24:26 2021 -0400
+++ b/config/license/header.txt Tue Nov 29 19:17:33 2022 -0400
@@ -1,7 +1,7 @@
Geekdroid is a utility library for development on the Android
Platform.
-Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/config/source-archive.gradle Sat Dec 11 00:24:26 2021 -0400
+++ b/config/source-archive.gradle Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid-firebase/build.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/build.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -14,10 +14,10 @@
android {
val compileSdkInt: Int by rootProject.extra
compileSdk = compileSdkInt
+ namespace = "com.geekorum.geekdroid.firebase"
defaultConfig {
minSdk = 24
- targetSdk = 29
}
configureJavaVersion()
@@ -30,7 +30,7 @@
}
lint {
- isAbortOnError = false
+ abortOnError = false
}
}
@@ -39,23 +39,22 @@
implementation(enforcedPlatform(kotlin("bom")))
implementation(kotlin("stdlib-jdk8"))
- implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.5"))
+ implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-core")
api("org.jetbrains.kotlinx:kotlinx-coroutines-play-services")
- implementation("com.jakewharton.timber:timber:4.7.1")
+ implementation("com.jakewharton.timber:timber:5.0.1")
- implementation("com.crashlytics.sdk.android:crashlytics:2.10.1")
- implementation("com.google.firebase:firebase-crashlytics:17.1.1")
+ implementation("com.google.firebase:firebase-crashlytics:18.3.2")
- api("com.google.firebase:firebase-firestore-ktx:21.5.0")
- implementation("com.google.firebase:firebase-auth:19.3.2")
+ api("com.google.firebase:firebase-firestore-ktx:24.4.1")
+ implementation("com.google.firebase:firebase-auth:21.1.0")
// not firebase but they often work together so here we are
- implementation("com.google.android.gms:play-services-location:17.0.0")
+ implementation("com.google.android.gms:play-services-location:21.0.1")
// not firebase but similar to gms api
- implementation("com.google.android.play:core:1.7.3")
+ implementation("com.google.android.play:core:1.10.3")
// fix for guava conflict
// firebase depends on a older version of these dependencies while testImplementation dependencies
--- a/geekdroid-firebase/src/androidTest/java/com/geekorum/geekdroid/firebase/ExampleInstrumentedTest.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/androidTest/java/com/geekorum/geekdroid/firebase/ExampleInstrumentedTest.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid-firebase/src/main/AndroidManifest.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/AndroidManifest.xml Tue Nov 29 19:17:33 2022 -0400
@@ -1,2 +1,24 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.geekorum.geekdroid.firebase" />
+<!--
+
+ Geekdroid is a utility library for development on the Android
+ Platform.
+
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
+
+ This file is part of Geekdroid.
+
+ Geekdroid is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Geekdroid is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
+
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/CurrentUserLiveData.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/CurrentUserLiveData.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/Firestore.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/Firestore.kt Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/Tasks.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/Tasks.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/logging/CrashlyticsLoggingTree.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/logging/CrashlyticsLoggingTree.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -22,25 +22,9 @@
package com.geekorum.geekdroid.firebase.logging
import android.util.Log
-import com.crashlytics.android.Crashlytics
import com.google.firebase.crashlytics.FirebaseCrashlytics
import timber.log.Timber
-/**
- * A [Timber.Tree] to log message in Firebase Crashlytics using Fabric.
- */
-@Deprecated("Use FirebaseCrashlyticsLoggingTree",
- ReplaceWith("FirebaseCrashlyticsLoggingTree(FirebaseCrashlytics.getInstance())", "com.google.firebase.crashlytics.FirebaseCrashlytics"))
-class CrashlyticsLoggingTree : Timber.Tree() {
- override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
- Crashlytics.log(priority, tag, message)
- if (priority >= Log.ERROR) {
- t?.let {
- Crashlytics.logException(it)
- }
- }
- }
-}
/**
* A [Timber.Tree] to log message in Firebase Crashlytics.
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/gms/LocationServices.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/gms/LocationServices.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -32,7 +32,7 @@
import kotlin.coroutines.resumeWithException
@RequiresPermission(anyOf = ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"])
-suspend fun FusedLocationProviderClient.requestLocation(locationRequest: LocationRequest): Location {
+suspend fun FusedLocationProviderClient.requestLocation(locationRequest: LocationRequest): Location? {
return suspendCancellableCoroutine { cont ->
val locationCallback = object : LocationCallback() {
override fun onLocationResult(result: LocationResult) {
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/gms/Tasks.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/gms/Tasks.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid-firebase/src/test/java/com/geekorum/geekdroid/firebase/ExampleUnitTest.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid-firebase/src/test/java/com/geekorum/geekdroid/firebase/ExampleUnitTest.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/build.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/build.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -37,10 +37,10 @@
android {
val compileSdkInt: Int by rootProject.extra
compileSdk = compileSdkInt
+ namespace = "com.geekorum.geekdroid"
defaultConfig {
minSdk = 24
- targetSdk = 29
}
configureJavaVersion()
@@ -53,52 +53,50 @@
}
lint {
- isAbortOnError = false
+ abortOnError = false
}
dataBinding {
- isEnabled = true
+ enable = true
}
}
dependencies {
- implementation("androidx.recyclerview:recyclerview:1.1.0")
- implementation("androidx.appcompat:appcompat:1.1.0")
- implementation("com.google.android.material:material:1.1.0")
- implementation("androidx.constraintlayout:constraintlayout:1.1.3")
- implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
- implementation("androidx.annotation:annotation:1.1.0")
- implementation("androidx.preference:preference:1.1.1")
- implementation("androidx.core:core-ktx:1.3.1")
- implementation("androidx.fragment:fragment-ktx:1.2.5")
+ implementation("androidx.recyclerview:recyclerview:1.2.1")
+ implementation("androidx.appcompat:appcompat:1.5.1")
+ implementation("com.google.android.material:material:1.7.0")
+ api("androidx.constraintlayout:constraintlayout:2.1.4")
+ implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
+ implementation("androidx.annotation:annotation:1.5.0")
+ implementation("androidx.preference:preference:1.2.0")
+ implementation("androidx.core:core-ktx:1.9.0")
+ implementation("androidx.fragment:fragment-ktx:1.5.4")
implementation("com.squareup.picasso:picasso:2.5.2")
- implementation("com.squareup.okhttp3:okhttp:4.6.0")
+ implementation("com.squareup.okhttp3:okhttp:4.10.0")
- val daggerVersion = "2.28.3"
+ val daggerVersion = "2.44.1"
implementation(enforcedDaggerPlatform(daggerVersion))
kapt(enforcedDaggerPlatform(daggerVersion))
implementation("com.google.dagger:dagger:$daggerVersion")
kapt("com.google.dagger:dagger-compiler:$daggerVersion")
- compileOnly("com.squareup.inject:assisted-inject-annotations-dagger2:0.5.2")
- kapt("com.squareup.inject:assisted-inject-processor-dagger2:0.5.2")
implementation(enforcedPlatform(kotlin("bom")))
implementation(kotlin("stdlib-jdk8"))
- implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.5"))
+ implementation(enforcedPlatform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
- implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0")
- implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0")
+ implementation("androidx.lifecycle:lifecycle-livedata-core-ktx:2.5.1")
+ implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1")
testImplementation("androidx.arch.core:core-testing:2.1.0")
- implementation("androidx.room:room-runtime:2.2.5")
- implementation("androidx.browser:browser:1.2.0")
- implementation("androidx.work:work-runtime:2.4.0")
- implementation("androidx.navigation:navigation-common-ktx:2.3.0")
- implementation("androidx.navigation:navigation-fragment:2.3.0")
+ implementation("androidx.room:room-runtime:2.4.3")
+ implementation("androidx.browser:browser:1.4.0")
+ implementation("androidx.work:work-runtime:2.7.1")
+ implementation("androidx.navigation:navigation-common-ktx:2.5.3")
+ implementation("androidx.navigation:navigation-fragment:2.5.3")
}
--- a/geekdroid/src/androidTest/java/com/geekorum/geekdroid/ExampleInstrumentedTest.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/androidTest/java/com/geekorum/geekdroid/ExampleInstrumentedTest.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/AndroidManifest.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/AndroidManifest.xml Tue Nov 29 19:17:33 2022 -0400
@@ -1,5 +1,27 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.geekorum.geekdroid">
+<!--
+
+ Geekdroid is a utility library for development on the Android
+ Platform.
+
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
+
+ This file is part of Geekdroid.
+
+ Geekdroid is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Geekdroid is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
+
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application />
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/RoomExt.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/RoomExt.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountAuthenticatorAppCompatActivity.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountAuthenticatorAppCompatActivity.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountSelector.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountSelector.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountTokenRetriever.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountTokenRetriever.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountsListViewModel.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountsListViewModel.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountsLiveData.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/AccountsLiveData.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/CancellableSyncAdapter.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/CancellableSyncAdapter.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/SyncInProgressLiveData.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/accounts/SyncInProgressLiveData.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/app/AppCompatPreferenceActivity.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/app/AppCompatPreferenceActivity.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/app/BottomSheetDialogActivity.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/app/BottomSheetDialogActivity.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -109,7 +109,7 @@
private fun initializeBottomSheet() {
binding = ActivityBottomSheetDialogBinding.inflate(layoutInflater, null, false)
behavior = BottomSheetBehavior.from(binding.bottomSheet)
- behavior.setBottomSheetCallback(callbackDelegator)
+ behavior.addBottomSheetCallback(callbackDelegator)
behavior.isHideable = cancelable
// We treat the CoordinatorLayout as outside the dialog though it is technically inside
binding.touchOutside.setOnClickListener {
@@ -133,7 +133,7 @@
}
}
- override fun performAccessibilityAction(host: View, action: Int, args: Bundle): Boolean {
+ override fun performAccessibilityAction(host: View, action: Int, args: Bundle?): Boolean {
if (action == AccessibilityNodeInfoCompat.ACTION_DISMISS && cancelable) {
finish()
return true
@@ -164,7 +164,7 @@
fun shouldFinishOnTouchOutside(): Boolean {
if (!canceledOnTouchOutsideSet) {
- val a = obtainStyledAttributes(
+ obtainStyledAttributes(
intArrayOf(android.R.attr.windowCloseOnTouchOutside)).use {
cancelOnTouchOutside = it.getBoolean(0, true)
}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/app/lifecycle/EventObserver.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/app/lifecycle/EventObserver.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/app/lifecycle/Transformations.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/app/lifecycle/Transformations.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/arch/PagingRequestHelper.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/arch/PagingRequestHelper.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/battery/LiveData.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/battery/LiveData.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -59,7 +59,7 @@
batteryStatus?.getBooleanExtra(BatteryManager.EXTRA_BATTERY_LOW, false) ?: false
} else {
val level = batteryStatus?.getIntExtra(BatteryManager.EXTRA_LEVEL, 0) ?: 0
- val scale = batteryStatus?.getIntExtra(BatteryManager.EXTRA_SCALE, 100) ?: 0
+ val scale = batteryStatus?.getIntExtra(BatteryManager.EXTRA_SCALE, 100) ?: 100
val percent = level.toFloat() / scale * 100
percent.roundToInt() <= 15
}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/bindings/BindingAdapters.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/bindings/BindingAdapters.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/bindings/Converters.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/bindings/Converters.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AndroidFrameworkModule.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AndroidFrameworkModule.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AndroidxCoreModule.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AndroidxCoreModule.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AppInitializers.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AppInitializers.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/AssistedInjection.kt Sat Dec 11 00:24:26 2021 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/**
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.geekdroid.dagger
-
-import com.squareup.inject.assisted.dagger2.AssistedModule
-import dagger.Module
-
-/**
- * Allows to use Assisted injection
- * Generates binding for Assisted injection factories
- */
-@AssistedModule
-@Module(includes = [AssistedInject_GeekdroidAssistedModule::class])
-internal abstract class GeekdroidAssistedModule
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/FragmentFactory.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/FragmentFactory.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/ViewModels.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/ViewModels.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -27,10 +27,11 @@
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.savedstate.SavedStateRegistryOwner
-import com.squareup.inject.assisted.Assisted
-import com.squareup.inject.assisted.AssistedInject
import dagger.MapKey
import dagger.Module
+import dagger.assisted.Assisted
+import dagger.assisted.AssistedFactory
+import dagger.assisted.AssistedInject
import dagger.multibindings.Multibinds
import javax.inject.Inject
import javax.inject.Provider
@@ -68,7 +69,7 @@
* ```
* @see [DaggerDelegateSavedStateVMFactory]
*/
-@Module(includes = [GeekdroidAssistedModule::class])
+@Module
abstract class ViewModelsModule private constructor() {
@Multibinds
@@ -137,7 +138,7 @@
throw IllegalArgumentException("No ViewModel providers for key $key and class $modelClass")
}
- @AssistedInject.Factory
+ @AssistedFactory
interface Creator {
fun create(owner: SavedStateRegistryOwner, defaultArgs: Bundle? = null): DaggerDelegateSavedStateVMFactory
}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/WorkerInjection.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/dagger/WorkerInjection.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/jobs/JobThread.java Sat Dec 11 00:24:26 2021 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/**
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.geekdroid.jobs;
-
-import android.app.job.JobParameters;
-import android.os.Process;
-import com.geekorum.geekdroid.utils.ProcessPriority;
-
-/**
- * A thread that execute a job from a {@link ThreadedJobService}
- * @Deprecated Use androidx.work
- */
-@Deprecated
-public abstract class JobThread extends Thread {
- private final ThreadedJobService jobService;
- private final JobParameters parameters;
-
- protected JobThread(ThreadedJobService jobService, JobParameters parameters) {
- this.jobService = jobService;
- this.parameters = parameters;
- }
-
- protected void setProcessPriority(@ProcessPriority int processPriority) {
- Process.setThreadPriority(processPriority);
- }
-
- protected void completeJob(boolean needReschedule) {
- jobService.completeJob(parameters, needReschedule);
- }
-
-}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/jobs/ThreadedJobService.java Sat Dec 11 00:24:26 2021 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/**
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.geekdroid.jobs;
-
-import android.app.job.JobParameters;
-import android.app.job.JobService;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-/**
- * Execute each job of the {@link JobService} in a separate thread.
- * @Deprecated Use androidx.work
- */
-@Deprecated
-public abstract class ThreadedJobService extends JobService {
- private Map<JobParameters, Future<?>> tasks = Collections.synchronizedMap(new HashMap<JobParameters, Future<?>>());
- private ExecutorService executorService;
-
- @Override
- public void onCreate() {
- super.onCreate();
- executorService = Executors.newCachedThreadPool();
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- executorService.shutdownNow();
- }
-
- @Override
- public boolean onStartJob(JobParameters params) {
- JobThread jobThread = createJobThread(params);
- if (jobThread == null) {
- return false;
- }
- Future<?> task = executorService.submit(jobThread);
- tasks.put(params, task);
- return true;
- }
-
- @Override
- public boolean onStopJob(JobParameters params) {
- Future<?> task = tasks.remove(params);
- if (task != null) {
- task.cancel(true);
- return true;
- }
- return false;
- }
-
- void completeJob(JobParameters jobParameters, boolean needReschedule) {
- Future<?> task = tasks.remove(jobParameters);
- if (task != null) {
- jobFinished(jobParameters, needReschedule);
- }
- }
-
- protected abstract JobThread createJobThread(JobParameters jobParameters);
-}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/loaders/ObjectCursorLoader.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/loaders/ObjectCursorLoader.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/network/BrowserLauncher.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/network/BrowserLauncher.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -136,11 +136,11 @@
launchUrl(context, uri) { customizer?.customize(this) }
}
- interface LaunchCustomizer {
+ fun interface LaunchCustomizer {
fun customize(builder: CustomTabsIntent.Builder)
}
- interface PreferredPackageSelector {
+ fun interface PreferredPackageSelector {
fun orderByPreference(availablePackages: List<String>): List<String>
}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/network/OkHttpWebViewClient.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/network/OkHttpWebViewClient.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/network/PicassoOkHttp3Downloader.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/network/PicassoOkHttp3Downloader.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/network/Socket.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/network/Socket.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/network/TokenRetriever.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/network/TokenRetriever.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/osslicenses/LicenseInfoRepository.kt Tue Nov 29 19:17:33 2022 -0400
@@ -0,0 +1,63 @@
+/*
+ * Geekdroid is a utility library for development on the Android
+ * Platform.
+ *
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
+ *
+ * This file is part of Geekdroid.
+ *
+ * Geekdroid is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Geekdroid is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.geekorum.geekdroid.osslicenses
+
+import android.content.Context
+import kotlinx.coroutines.CoroutineDispatcher
+import kotlinx.coroutines.withContext
+
+class LicenseInfoRepository(
+ private val appContext: Context,
+ private val mainCoroutineDispatcher: CoroutineDispatcher,
+ private val ioCoroutineDispatcher: CoroutineDispatcher,
+) {
+
+ private var licensesInfo: Map<String, String>? = null
+
+ suspend fun getLicensesInfo(): Map<String, String> = withContext(mainCoroutineDispatcher) {
+ parseLicenses()
+ checkNotNull(licensesInfo)
+ }
+
+ suspend fun getLicenseFor(dependency: String): String = withContext(mainCoroutineDispatcher) {
+ parseLicenses()
+ checkNotNull(licensesInfo).let {
+ return@withContext it[dependency] ?: error("Dependency not found")
+ }
+ }
+
+ private suspend fun parseLicenses() = withContext(mainCoroutineDispatcher) {
+ if (licensesInfo == null) {
+ val licenses = withContext(ioCoroutineDispatcher) {
+ OssLicenseParser.openDefaultThirdPartyLicenses(appContext).use { licensesInput ->
+ OssLicenseParser.openDefaultThirdPartyLicensesMetadata(appContext).use { licensesMetadataInput ->
+ val parser = OssLicenseParser(
+ thirdPartyLicensesInput = licensesInput,
+ thirdPartyLicensesMetadataInput = licensesMetadataInput)
+ parser.parseLicenses()
+ }
+ }
+ }
+ licensesInfo = licenses
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/osslicenses/OssLicenseParser.kt Tue Nov 29 19:17:33 2022 -0400
@@ -0,0 +1,122 @@
+/*
+ * Geekdroid is a utility library for development on the Android
+ * Platform.
+ *
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
+ *
+ * This file is part of Geekdroid.
+ *
+ * Geekdroid is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Geekdroid is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.geekorum.geekdroid.osslicenses
+
+import android.annotation.SuppressLint
+import android.content.Context
+import okio.ByteString
+import okio.buffer
+import okio.source
+import java.io.InputStream
+
+/**
+ * Parse licences data generated by the "com.google.android.gms.oss-licenses-plugin" gradle plugin.
+ * [thirdPartyLicensesInput] is usually res/raw/third_party_licenses file
+ * [thirdPartyLicensesMetadataInput] is usually res/raw/third_party_license_metadata file
+ */
+class OssLicenseParser(
+ private val thirdPartyLicensesInput: InputStream,
+ private val thirdPartyLicensesMetadataInput: InputStream
+) {
+ fun parseLicenses(): Map<String, String> {
+ val licenses = readLicensesFile()
+ return buildLicenseInfo(licenses)
+ }
+
+ private fun readLicensesFile(): ByteString {
+ return thirdPartyLicensesInput.source().use { source ->
+ source.buffer().use {
+ it.readByteString()
+ }
+ }
+ }
+
+ private fun buildLicenseInfo(license: ByteString): Map<String, String> {
+ return thirdPartyLicensesMetadataInput.source().use { source ->
+ source.buffer().use {
+ buildMap {
+ while (true) {
+ val line = it.readUtf8Line() ?: break
+ if (line.isNotBlank()) {
+ with(line.toLineParser()) {
+ val start = readStartIdx()
+ val length = readLength()
+ val dependency = readName()
+ val licenseTxt = license.substring(
+ beginIndex = start,
+ endIndex = start + length + 1
+ ).string(Charsets.UTF_8)
+ put(dependency, licenseTxt)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ companion object {
+ @SuppressLint("DiscouragedApi")
+ fun openDefaultThirdPartyLicenses(context: Context): InputStream {
+ val thirdPartyLicensesId = context.resources.getIdentifier("third_party_licenses", "raw", context.packageName)
+ check(thirdPartyLicensesId != 0) { "third_party_licenses was not found in resources raw of ${context.packageName}"}
+ return context.resources.openRawResource(thirdPartyLicensesId)
+ }
+
+ @SuppressLint("DiscouragedApi")
+ fun openDefaultThirdPartyLicensesMetadata(context: Context): InputStream {
+ val thirdPartyLicensesMetadataId = context.resources.getIdentifier("third_party_license_metadata", "raw", context.packageName)
+ check(thirdPartyLicensesMetadataId != 0) { "third_party_license_metadata was not found in resources raw of ${context.packageName}"}
+ return context.resources.openRawResource(thirdPartyLicensesMetadataId)
+ }
+ }
+}
+
+private class LicenseMetadataLineParser(
+ private val line: String
+) {
+
+ private var idx = 0
+
+ fun readStartIdx(): Int {
+ val end = line.indexOf(':', startIndex = idx)
+ val result = line.substring(idx, end).toInt()
+ idx = end + 1
+ return result
+ }
+
+ fun readLength(): Int {
+ val end = line.indexOf(' ', startIndex = idx)
+ val result = line.substring(idx, end).toInt()
+ idx = end + 1
+ return result
+ }
+
+ fun readName(): String {
+ val result = line.substring(idx)
+ idx = line.length + 1
+ return result
+ }
+
+}
+
+private fun String.toLineParser() = LicenseMetadataLineParser(this)
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/preferences/PreferenceSummaryBinder.java Sat Dec 11 00:24:26 2021 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/**
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.geekdroid.preferences;
-
-import androidx.preference.ListPreference;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceManager;
-
-/**
- * Helper class to set the summary of an {@link android.preference.Preference} to its actual value.
- * @deprecated use androidx.preference.Preference.SummaryProvider
- */
-@Deprecated
-public class PreferenceSummaryBinder implements Preference.OnPreferenceChangeListener {
-
- /**
- * A preference value change listener that updates the preference's summary
- * to reflect its new value.
- */
- @Override
- public boolean onPreferenceChange(Preference preference, Object value) {
- String stringValue = value.toString();
-
- if (preference instanceof ListPreference) {
- setListPreferenceSummary(preference, stringValue);
- } else {
- setGenericPreferenceSummary(preference, stringValue);
- }
- return true;
- }
-
- private void setGenericPreferenceSummary(Preference preference, String stringValue) {
- // For all other preferences, set the summary to the value's
- // simple string representation.
- preference.setSummary(stringValue);
- }
-
- private void setListPreferenceSummary(Preference preference, String stringValue) {
- // For list preferences, look up the correct display value in
- // the preference's 'entries' list.
- ListPreference listPreference = (ListPreference) preference;
- int index = listPreference.findIndexOfValue(stringValue);
-
- // Set the summary to reflect the new value.
- preference.setSummary(
- index >= 0
- ? listPreference.getEntries()[index]
- : null);
- }
-
- /**
- * Binds a preference's summary to its value. More specifically, when the
- * preference's value is changed, its summary (line of text below the
- * preference title) is updated to reflect the value. The summary is also
- * immediately updated upon calling this method. The exact display format is
- * dependent on the type of preference.
- *
- */
- public void bindPreferenceSummaryToValue(Preference preference) {
- // Set the listener to watch for value changes.
- preference.setOnPreferenceChangeListener(this);
-
- // Trigger the listener immediately with the preference's
- // current value.
- onPreferenceChange(preference,
- PreferenceManager
- .getDefaultSharedPreferences(preference.getContext())
- .getString(preference.getKey(), ""));
- }
-
-
-}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/preferences/RingtonePreferenceSummaryBinder.kt Sat Dec 11 00:24:26 2021 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/**
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.geekdroid.preferences
-
-import android.media.Ringtone
-import android.media.RingtoneManager
-import android.preference.Preference
-import android.preference.RingtonePreference
-import androidx.core.net.toUri
-import androidx.preference.PreferenceManager
-import com.geekorum.geekdroid.R
-
-/**
- * Helper class to set the summary of an [android.preference.RingtonePreference] to its actual value.
- * @deprecated use androidx.preference.Preference.SummaryProvider
- */
-@Deprecated("Use androidx.preference.Preference.SummaryProvider")
-class RingtonePreferenceSummaryBinder : Preference.OnPreferenceChangeListener {
- override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {
- val stringValue = newValue.toString()
-
- when (preference) {
- is RingtonePreference -> setRingtonePreferenceSummary(preference, stringValue)
- }
- return true
- }
-
- private fun setRingtonePreferenceSummary(preference: Preference, stringValue: String) {
- val summary = when {
- // Empty values correspond to 'silent' (no ringtone).
- stringValue.isEmpty() -> preference.context.getString(R.string.geekdroid_pref_ringtone_silent)
- else -> {
- val ringtone: Ringtone? = RingtoneManager.getRingtone(preference.context, stringValue.toUri())
- ringtone?.getTitle(preference.context)
- }
- }
- preference.summary = summary
- }
-
- /**
- * Binds a preference's summary to its value. More specifically, when the
- * preference's value is changed, its summary (line of text below the
- * preference title) is updated to reflect the value. The summary is also
- * immediately updated upon calling this method. The exact display format is
- * dependent on the type of preference.
- *
- */
- fun bindPreferenceSummaryToValue(preference: Preference) {
- // Set the listener to watch for value changes.
- preference.onPreferenceChangeListener = this
-
- // Trigger the listener immediately with the preference's
- // current value.
- onPreferenceChange(preference,
- PreferenceManager
- .getDefaultSharedPreferences(preference.context)
- .getString(preference.key, "")!!)
- }
-
-}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/security/SimpleEncryption.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/security/SimpleEncryption.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/utils/PriorityRunnable.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/utils/PriorityRunnable.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/utils/ProcessPriority.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/utils/ProcessPriority.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/AccountMenuLineView.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/AccountMenuLineView.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/CheckableImageView.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/CheckableImageView.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/EdgeToEdge.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/EdgeToEdge.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/MultipleLongClickGestureDetector.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/MultipleLongClickGestureDetector.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/ReturningBottomAppBar.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/ReturningBottomAppBar.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/banners/Banners.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/banners/Banners.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -100,7 +100,7 @@
private fun bindExtendedBanner(binding: ViewBannerExtendedBinding, banner: BannerSpec) {
binding.message.text = banner.message
- binding.icon.setImageIcon(banner.icon?.toIcon())
+ binding.icon.setImageIcon(banner.icon?.toIcon(binding.icon.context))
if (banner.icon == null) {
binding.icon.visibility = View.GONE
}
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/banners/Builders.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/banners/Builders.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/behaviors/NestedCoordinatorLayout.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/behaviors/NestedCoordinatorLayout.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/behaviors/ScrollAwareFABBehavior.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/behaviors/ScrollAwareFABBehavior.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/behaviors/SwingBottomItemAnimator.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/behaviors/SwingBottomItemAnimator.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/FirstLayoutItemAnimator.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/FirstLayoutItemAnimator.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/ItemSwiper.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/ItemSwiper.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/ScrollFromBottomAppearanceItemAnimator.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/ScrollFromBottomAppearanceItemAnimator.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/SingleItemSwipedCallback.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/SingleItemSwipedCallback.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/SpacingItemDecoration.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/SpacingItemDecoration.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/ViewItemDecoration.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/java/com/geekorum/geekdroid/views/recyclerview/ViewItemDecoration.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/main/res/drawable/view_account_menu_line_handle_closed.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/drawable/view_account_menu_line_handle_closed.xml Tue Nov 29 19:17:33 2022 -0400
@@ -3,7 +3,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/drawable/view_account_menu_line_handle_open.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/drawable/view_account_menu_line_handle_open.xml Tue Nov 29 19:17:33 2022 -0400
@@ -3,7 +3,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/drawable/view_account_menu_line_handle_selector.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/drawable/view_account_menu_line_handle_selector.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/layout/activity_bottom_sheet_dialog.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/layout/activity_bottom_sheet_dialog.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/layout/view_account_menu_line.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/layout/view_account_menu_line.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/layout/view_banner_extended.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/layout/view_banner_extended.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/layout/view_banner_simple.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/layout/view_banner_simple.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/values/attrs.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/values/attrs.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/values/ids.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/values/ids.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/values/strings.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/values/strings.xml Tue Nov 29 19:17:33 2022 -0400
@@ -3,7 +3,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/main/res/values/styles.xml Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/main/res/values/styles.xml Tue Nov 29 19:17:33 2022 -0400
@@ -4,7 +4,7 @@
Geekdroid is a utility library for development on the Android
Platform.
- Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
This file is part of Geekdroid.
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/accounts/AccountsLiveDataTest.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/accounts/AccountsLiveDataTest.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -23,6 +23,7 @@
import android.accounts.Account;
import android.accounts.AccountManager;
+import android.os.Build;
import androidx.arch.core.executor.testing.InstantTaskExecutorRule;
import androidx.lifecycle.Lifecycle;
@@ -50,7 +51,8 @@
import java.util.List;
@RunWith(AndroidJUnit4.class)
-@Config(shadows = {com.geekorum.geekdroid.shadows.ShadowAccountManager.class})
+@Config(shadows = {com.geekorum.geekdroid.shadows.ShadowAccountManager.class},
+ sdk = Build.VERSION_CODES.Q)
public class AccountsLiveDataTest {
@Rule
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/accounts/CancellableSyncAdapterTest.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/accounts/CancellableSyncAdapterTest.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/accounts/SyncInProgressLiveDataTest.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/accounts/SyncInProgressLiveDataTest.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -23,6 +23,7 @@
import android.accounts.Account;
import android.content.ContentResolver;
+import android.os.Build;
import android.os.Bundle;
import androidx.arch.core.executor.testing.InstantTaskExecutorRule;
@@ -44,7 +45,8 @@
import org.robolectric.annotation.Config;
@RunWith(AndroidJUnit4.class)
-@Config(shadows = {ShadowContentResolver.class})
+@Config(shadows = {ShadowContentResolver.class},
+ sdk = Build.VERSION_CODES.Q)
public class SyncInProgressLiveDataTest {
@Rule
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/battery/LiveDataTest.kt Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/battery/LiveDataTest.kt Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
@@ -44,6 +44,7 @@
import kotlin.test.BeforeTest
@RunWith(AndroidJUnit4::class)
+@Config(minSdk = Build.VERSION_CODES.Q)
class BatterySaverLiveDataTest {
lateinit var liveData: BatterySaverLiveData
@@ -81,6 +82,7 @@
}
@RunWith(AndroidJUnit4::class)
+@Config(minSdk = Build.VERSION_CODES.Q)
class LowBatteryLiveDataTest {
lateinit var liveData: LowBatteryLiveData
@@ -135,17 +137,4 @@
}
}
- @Test
- @Config(maxSdk = Build.VERSION_CODES.O_MR1)
- fun testThatBeforePWhenBatteryIsAlreadyLowLivedataIsCorrect() {
- val mockObserver = mockk<Observer<Boolean>>(relaxed = true)
- application.sendStickyBroadcast(Intent(Intent.ACTION_BATTERY_CHANGED).apply {
- putExtra(BatteryManager.EXTRA_LEVEL, 5)
- putExtra(BatteryManager.EXTRA_SCALE, 100)
- })
- liveData.observeForever(mockObserver)
- verifySequence {
- mockObserver.onChanged(true)
- }
- }
}
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/shadows/ShadowAccountManager.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/shadows/ShadowAccountManager.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/shadows/ShadowContentResolver.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/shadows/ShadowContentResolver.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/geekdroid/src/test/java/com/geekorum/geekdroid/utils/LifecycleMock.java Sat Dec 11 00:24:26 2021 -0400
+++ b/geekdroid/src/test/java/com/geekorum/geekdroid/utils/LifecycleMock.java Tue Nov 29 19:17:33 2022 -0400
@@ -1,8 +1,8 @@
-/**
+/*
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*
--- a/gradle/wrapper/gradle-wrapper.properties Sat Dec 11 00:24:26 2021 -0400
+++ b/gradle/wrapper/gradle-wrapper.properties Tue Nov 29 19:17:33 2022 -0400
@@ -2,4 +2,4 @@
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
--- a/settings.gradle.kts Sat Dec 11 00:24:26 2021 -0400
+++ b/settings.gradle.kts Tue Nov 29 19:17:33 2022 -0400
@@ -2,7 +2,7 @@
* Geekdroid is a utility library for development on the Android
* Platform.
*
- * Copyright (C) 2017-2020 by Frederic-Charles Barthelery.
+ * Copyright (C) 2017-2022 by Frederic-Charles Barthelery.
*
* This file is part of Geekdroid.
*