Skip to content

Commit

Permalink
chore(build): update dependencies and Gradle settings (#312)
Browse files Browse the repository at this point in the history
- Replace plugin IDs with versions from libs.versions.toml.
- Update compileSdk to 34.
- Update various dependencies to their latest versions.
- Modify onDraw method arguments to be non-nullable.
- Refactor build scripts to align with new dependency management practices.

# GENERATE BY https://aicommit.app
  • Loading branch information
rosuH authored Jul 10, 2024
1 parent 9929aea commit 6e03bc4
Show file tree
Hide file tree
Showing 16 changed files with 375 additions and 143 deletions.
110 changes: 88 additions & 22 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-parcelize")
id("org.jetbrains.kotlin.kapt")
id("dagger.hilt.android.plugin")
id(libs.plugins.android.application.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.kotlin.parcelize.get().pluginId)
id(libs.plugins.ksp.get().pluginId)
id(libs.plugins.hilt.plugin.get().pluginId)
}

android {
Expand All @@ -15,8 +15,8 @@ android {
applicationId = "me.rosuh.easywatermark"
minSdk = (Apps.minSdk)
targetSdk = (Apps.targetSdk)
versionCode = 20809
versionName = "2.8.9"
versionCode = 20900
versionName = "2.9.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "$applicationId-v$versionName($versionCode)")
}
Expand Down Expand Up @@ -62,36 +62,48 @@ android {

namespace = "me.rosuh.easywatermark"

lint {
baseline = file("lint-baseline.xml")
// lint {
// baseline = file("lint-baseline.xml")
// quiet = true
// abortOnError = false
// checkReleaseBuilds = false
// }

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}

kotlin {
jvmToolchain(17)
}
}

kapt {
correctErrorTypes = true
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(project(mapOf("path" to ":cmonet")))

implementation(libs.room.runtime)
implementation(libs.room.ktx)
kapt(libs.room.compiler)
implementation(libs.core.ktx)
ksp(libs.room.compiler)

implementation(libs.datastore.preference)

implementation(libs.dagger.hilt.android)
kapt(libs.dagger.hilt.compiler)
// di
implementation(libs.hilt.android)
ksp(libs.hilt.compiler)
androidTestImplementation(libs.hilt.testing)
kspAndroidTest(libs.hilt.compiler)

implementation(libs.asyncLayoutInflater)
implementation(libs.asynclayout.inflater)

implementation(libs.glide.glide)
kapt(libs.glide.compiler)
implementation(libs.glide)
ksp(libs.glide.compiler)

implementation(libs.compressor)

Expand All @@ -105,13 +117,13 @@ dependencies {
implementation(libs.activity.ktx)
implementation(libs.lifecycle.runtime.ktx)
implementation(libs.lifecycle.livedata.ktx)
implementation(libs.lifecycle.viewModel.ktx)
implementation(libs.lifecycle.viewmodel.ktx)
implementation(libs.viewpager2)
implementation(libs.recyclerview)
implementation(libs.constraintLayout)
implementation(libs.exifInterface)
implementation(libs.constraintlayout)
implementation(libs.exifinterface)
implementation(libs.palette.ktx)
implementation(libs.profieinstaller)
implementation(libs.profileinstaller)

implementation(libs.colorpicker)

Expand All @@ -126,4 +138,58 @@ dependencies {
androidTestImplementation(libs.test.espresso.core)
androidTestImplementation(libs.test.uiautomator)
androidTestImplementation(libs.test.ext.junit)

// or only import the main APIs for the underlying toolkit systems,
// such as input and measurement/layout
// val composeBom = platform("androidx.compose:compose-bom:2023.10.00")
// implementation(composeBom)
// androidTestImplementation(composeBom)
implementation(platform(libs.androidx.compose.bom))
androidTestImplementation(platform(libs.androidx.compose.bom))
// implementation("androidx.compose.material3:material3:1.2.0-alpha09")
// implementation("androidx.compose.material3:material3-window-size-class:1.1.2")
// implementation(libs.material)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material3.windowSizeClass)
// implementation("androidx.compose.ui:ui")
implementation(libs.androidx.compose.ui.ui)

// implementation("androidx.compose.ui:ui-tooling-preview")
// debugImplementation("androidx.compose.ui:ui-tooling")
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.ui.tooling)

// Optional - Integration with activities
// implementation("androidx.activity:activity-compose:1.8.0")
implementation(libs.androidx.activity.compose)
// Optional - Integration with ViewModels
// implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2")
implementation(libs.androidx.compose.lifecycle.viewmodel)

// When using a MDC theme
// implementation("com.google.android.material:compose-theme-adapter:1.2.1")

// implementation("com.google.accompanist:accompanist-permissions:0.33.2-alpha")
implementation(libs.accompanist.permissions)
// implementation("io.coil-kt:coil-compose:2.3.0")
implementation(libs.coil.kt)
implementation(libs.coil.kt.compose)
implementation(libs.coil.kt.svg)

// implementation("androidx.compose.runtime:runtime-livedata:1.5.3")
implementation(libs.androidx.compose.runtime.livedata)

// implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.2")
implementation(libs.androidx.lifecycle.runtime.compose)

// implementation("androidx.navigation:navigation-compose:2.7.4")
implementation(libs.androidx.navigation.compose)

// implementation("com.google.accompanist:accompanist-navigation-animation:0.31.1-alpha")
implementation(libs.accompanist.navigation.animation)

// implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
implementation(libs.androidx.constraintlayout.compose)
implementation(libs.androidx.motionlayoout.compose)

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CircleImageView : AppCompatImageView {
}

@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
if (sourceImageBitmap == null || (sizeHasChanged && width > 0 && height > 0)) {
super.onDraw(canvas)
sourceImageBitmap = drawable.toBitmap(width, height)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ColoredImageVIew : AppCompatImageView {
}

@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
if (innerBitmap == null || (sizeHasChanged && width > 0 && height > 0)) {
super.onDraw(canvas)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ class ProgressImageView : AppCompatImageView {
private val saveLayerBounds = RectF()

@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
if (measuredWidth < 0 || measuredHeight <= 0 || drawable == null
|| drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0 || canvas == null
|| curX <= 0f || !enableProgress.get()
if ((measuredWidth < 0 || measuredHeight <= 0 || drawable == null
|| drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0) || curX <= 0f || !enableProgress.get()
) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class RadioButton : View {
return ContextCompat.getDrawable(context, iconRes) ?: ColorDrawable(context.colorOnSurface)
}

override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
// draw background
paint.style = Paint.Style.FILL
paint.color = if (isChecked) bgColorSelected else bgColorNormal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SelectableImageView : View {
invalidate()
}

override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
if (isSelected) {
canvas?.drawCircle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,16 @@ class TouchSensitiveRv : RecyclerView {
borderAnimator.cancel()
}

override fun onDraw(c: Canvas?) {
override fun onDraw(c: Canvas) {
super.onDraw(c)
c?.withSave {
c.withSave {
drawRect(
glowRectF,
glowPaint
)
}
if (enableBorder && scrollState == SCROLL_STATE_IDLE) {
c?.drawRoundRect(borderRectF, 2F.dp, 2F.dp, borderPaint)
c.drawRoundRect(borderRectF, 2F.dp, 2F.dp, borderPaint)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class WaterMarkImageView : androidx.appcompat.widget.AppCompatImageView, Corouti
Log.i("onSizeChanged", "$w, $h, $oldh, $oldh")
}

override fun onDraw(canvas: Canvas?) {
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
if (config?.text.isNullOrEmpty()
|| decodedUri.toString().isEmpty()
Expand Down
Binary file modified app/src/main/res/drawable-xxhdpi/bg_avatar_dev.webp
Binary file not shown.
11 changes: 7 additions & 4 deletions baseBenchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
plugins {
id("com.android.library")
id("kotlin-android")
id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.ksp.get().pluginId)
}

android {
namespace = "me.rosuh.benchmark.macro.base"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = Apps.minSdk
Expand All @@ -29,4 +30,6 @@ android {
}
}

dependencies {}
dependencies {
implementation(libs.core.ktx)
}
54 changes: 24 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
buildscript {

repositories {
google()
mavenCentral()
maven("https://jitpack.io")
maven("https://plugins.gradle.org/m2/")
google()
gradlePluginPortal()
}

dependencies {
classpath("com.android.tools.build:gradle:8.1.0")
classpath(libs.kotlin.plugin)
classpath(libs.ktlint.gradle)
classpath(libs.dagger.hilt.plugin)
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath(libs.agp)
classpath(libs.kotlin.gradlePlugin)
classpath(libs.hilt.plugin)
}
}

allprojects {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}

apply(plugin = "org.jlleitschuh.gradle.ktlint")

subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent
//apply(plugin = "org.jlleitschuh.gradle.ktlint")
//
//subprojects {
// apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent
//
// repositories {
// // Required to download KtLint
// mavenCentral()
// }
//
// // Optionally configure plugin
// configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
// debug.set(true)
// }
//}

repositories {
// Required to download KtLint
mavenCentral()
}

// Optionally configure plugin
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
debug.set(true)
}
plugins {
alias(libs.plugins.hilt) apply false
alias(libs.plugins.ksp) apply false
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Apps {
const val compileSdk = 33
const val compileSdk = 34
const val buildTools = "33.0.0"
const val minSdk = 23
const val targetSdk = 33
Expand Down
6 changes: 4 additions & 2 deletions cmonet/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.ksp.get().pluginId)
}

android {
Expand All @@ -22,6 +23,7 @@ dependencies {
implementation(libs.core.ktx)
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.core.ktx)
testImplementation(libs.test.junit)
androidTestImplementation(libs.test.ext.junit)
androidTestImplementation(libs.test.espresso.core)
Expand Down
Loading

0 comments on commit 6e03bc4

Please sign in to comment.