Skip to content

Commit

Permalink
Technical: Update to Kotlin 2.0.0 & more.
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech committed Aug 5, 2024
1 parent 65aaa62 commit 246c42b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ minSdk = "21"
compileSdk = "34"
targetSdk = "34"

androidgradleplugin = "8.4.0"
kotlin = "1.9.24"
androidgradleplugin = "8.5.1"
kotlin = "2.0.0"
kotlinxcoroutines = "1.8.1"
ktlint = "1.2.1"
ktlint = "1.3.1"

[libraries]
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.9.0" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.6.1" }
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.9.1" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.0" }
androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.13.1" }
androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version = "1.3.7" }
androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.7.1" }
androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.1.5" }
androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.8.2" }
androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.2.1" }
junit = { module = "junit:junit", version = "4.13.2" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxcoroutines" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxcoroutines" }
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.14" }
material = { module = "com.google.android.material:material", version = "1.12.0" }
mock = { module = "io.mockk:mockk", version = "1.13.11" }
mock = { module = "io.mockk:mockk", version = "1.13.12" }
plugin-android-cache-fix = { module = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin", version = "3.0.1" }
plugin-androidgradleplugin = { module = "com.android.tools.build:gradle", version.ref = "androidgradleplugin" }
plugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" }
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
plugin-licensee = { module = "app.cash.licensee:licensee-gradle-plugin", version = "1.11.0" }
plugin-paparazzi = { module = "app.cash.paparazzi:paparazzi-gradle-plugin", version = "1.3.3" }
plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.28.0" }
plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.29.0" }
robolectric = { module = "org.robolectric:robolectric", version = "4.12.1" }
timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" }

Expand Down
5 changes: 5 additions & 0 deletions lint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<lint>
<issue id="SyntheticAccessor" severity="error"/>

<!-- Our pace. -->
<issue id="GradleDependency" severity="ignore" in="cli,gradle"/>
<issue id="NewerVersionAvailable" severity="ignore" in="cli,gradle"/>
<issue id="AndroidGradlePluginVersion" severity="ignore" in="cli,gradle"/>

<!-- View Binding bugs. -->
<issue id="UnusedIds">
<ignore regexp=".*"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
import com.canhub.cropper.CropImage
import com.canhub.cropper.CropImageOptions
Expand All @@ -25,6 +26,7 @@ import timber.log.Timber

internal class SampleUsingImageViewFragment :
Fragment(),
MenuProvider,
SampleOptionsBottomSheet.Listener,
OnSetImageUriCompleteListener,
OnCropImageCompleteListener {
Expand All @@ -41,7 +43,7 @@ internal class SampleUsingImageViewFragment :
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
setHasOptionsMenu(true)
activity?.addMenuProvider(this)
_binding = FragmentCropImageViewBinding.inflate(layoutInflater, container, false)
return binding.root
}
Expand Down Expand Up @@ -86,12 +88,11 @@ internal class SampleUsingImageViewFragment :
binding.cropImageView.setImageCropOptions(options)
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.main, menu)
super.onCreateOptionsMenu(menu, inflater)
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.main, menu)
}

override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
override fun onMenuItemSelected(menuItem: MenuItem) = when (menuItem.itemId) {
R.id.main_action_crop -> {
binding.cropImageView.croppedImageAsync()
true
Expand All @@ -108,7 +109,7 @@ internal class SampleUsingImageViewFragment :
binding.cropImageView.flipImageVertically()
true
}
else -> super.onOptionsItemSelected(item)
else -> false
}

override fun onSetImageUriComplete(view: CropImageView, uri: Uri, error: Exception?) {
Expand Down

0 comments on commit 246c42b

Please sign in to comment.