Skip to content

Commit

Permalink
Technical: Update to Kotlin 2.0.0 & more. (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech authored Aug 5, 2024
1 parent 65aaa62 commit 6aebb15
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 18 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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
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 6aebb15

Please sign in to comment.