Skip to content

Commit 6aebb15

Browse files
authored
Technical: Update to Kotlin 2.0.0 & more. (#634)
1 parent 65aaa62 commit 6aebb15

7 files changed

Lines changed: 29 additions & 18 deletions

File tree

gradle/libs.versions.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ minSdk = "21"
33
compileSdk = "34"
44
targetSdk = "34"
55

6-
androidgradleplugin = "8.4.0"
7-
kotlin = "1.9.24"
6+
androidgradleplugin = "8.5.1"
7+
kotlin = "2.0.0"
88
kotlinxcoroutines = "1.8.1"
9-
ktlint = "1.2.1"
9+
ktlint = "1.3.1"
1010

1111
[libraries]
12-
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.9.0" }
13-
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.6.1" }
12+
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.9.1" }
13+
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.7.0" }
1414
androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.13.1" }
1515
androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version = "1.3.7" }
16-
androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.7.1" }
17-
androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.1.5" }
16+
androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.8.2" }
17+
androidx-test-junit = { module = "androidx.test.ext:junit", version = "1.2.1" }
1818
junit = { module = "junit:junit", version = "4.13.2" }
1919
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxcoroutines" }
2020
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxcoroutines" }
2121
leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version = "2.14" }
2222
material = { module = "com.google.android.material:material", version = "1.12.0" }
23-
mock = { module = "io.mockk:mockk", version = "1.13.11" }
23+
mock = { module = "io.mockk:mockk", version = "1.13.12" }
2424
plugin-android-cache-fix = { module = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin", version = "3.0.1" }
2525
plugin-androidgradleplugin = { module = "com.android.tools.build:gradle", version.ref = "androidgradleplugin" }
2626
plugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" }
2727
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
2828
plugin-licensee = { module = "app.cash.licensee:licensee-gradle-plugin", version = "1.11.0" }
2929
plugin-paparazzi = { module = "app.cash.paparazzi:paparazzi-gradle-plugin", version = "1.3.3" }
30-
plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.28.0" }
30+
plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.29.0" }
3131
robolectric = { module = "org.robolectric:robolectric", version = "4.12.1" }
3232
timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" }
3333

gradle/wrapper/gradle-wrapper.jar

51 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lint.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
<lint>
33
<issue id="SyntheticAccessor" severity="error"/>
44

5+
<!-- Our pace. -->
6+
<issue id="GradleDependency" severity="ignore" in="cli,gradle"/>
7+
<issue id="NewerVersionAvailable" severity="ignore" in="cli,gradle"/>
8+
<issue id="AndroidGradlePluginVersion" severity="ignore" in="cli,gradle"/>
9+
510
<!-- View Binding bugs. -->
611
<issue id="UnusedIds">
712
<ignore regexp=".*"/>

sample/src/main/kotlin/com/canhub/cropper/sample/SampleUsingImageViewFragment.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import android.view.View
1111
import android.view.ViewGroup
1212
import android.widget.Toast
1313
import androidx.activity.result.contract.ActivityResultContracts
14+
import androidx.core.view.MenuProvider
1415
import androidx.fragment.app.Fragment
1516
import com.canhub.cropper.CropImage
1617
import com.canhub.cropper.CropImageOptions
@@ -25,6 +26,7 @@ import timber.log.Timber
2526

2627
internal class SampleUsingImageViewFragment :
2728
Fragment(),
29+
MenuProvider,
2830
SampleOptionsBottomSheet.Listener,
2931
OnSetImageUriCompleteListener,
3032
OnCropImageCompleteListener {
@@ -41,7 +43,7 @@ internal class SampleUsingImageViewFragment :
4143
container: ViewGroup?,
4244
savedInstanceState: Bundle?,
4345
): View {
44-
setHasOptionsMenu(true)
46+
activity?.addMenuProvider(this)
4547
_binding = FragmentCropImageViewBinding.inflate(layoutInflater, container, false)
4648
return binding.root
4749
}
@@ -86,12 +88,11 @@ internal class SampleUsingImageViewFragment :
8688
binding.cropImageView.setImageCropOptions(options)
8789
}
8890

89-
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
90-
inflater.inflate(R.menu.main, menu)
91-
super.onCreateOptionsMenu(menu, inflater)
91+
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
92+
menuInflater.inflate(R.menu.main, menu)
9293
}
9394

94-
override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
95+
override fun onMenuItemSelected(menuItem: MenuItem) = when (menuItem.itemId) {
9596
R.id.main_action_crop -> {
9697
binding.cropImageView.croppedImageAsync()
9798
true
@@ -108,7 +109,7 @@ internal class SampleUsingImageViewFragment :
108109
binding.cropImageView.flipImageVertically()
109110
true
110111
}
111-
else -> super.onOptionsItemSelected(item)
112+
else -> false
112113
}
113114

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

0 commit comments

Comments
 (0)