diff --git a/.editorconfig b/.editorconfig index 6c984094..b0a62b05 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,16 @@ [*.{kt,kts}] +ktlint_code_style=intellij_idea indent_size=2 continuation_indent_size=2 -insert_final_newline=true ij_kotlin_allow_trailing_comma=true ij_kotlin_allow_trailing_comma_on_call_site=true +insert_final_newline=true ktlint_standard_annotation=disabled -ktlint_standard_argument-list-wrapping=disabled -ktlint_standard_spacing-between-declarations-with-annotations=disabled +ktlint_standard_max-line-length=disabled ktlint_standard_filename=disabled -ktlint_standard_property-naming=disabled +ktlint_standard_spacing-between-declarations-with-annotations=disabled +ktlint_standard_blank-line-between-when-conditions=disabled +ktlint_standard_backing-property-naming=disabled +ktlint_standard_kdoc=disabled +ktlint_standard_condition-wrapping=disabled +ktlint_experimental=enabled \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 1015ef74..5beaa3b6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,6 @@ codeQualityTools { } ktlint { toolVersion = libs.versions.ktlint.get() - experimental = true } detekt { enabled = false // Don"t want. diff --git a/cropper/build.gradle.kts b/cropper/build.gradle.kts index 47145ef0..ed7645de 100644 --- a/cropper/build.gradle.kts +++ b/cropper/build.gradle.kts @@ -59,3 +59,24 @@ dependencies { testImplementation(libs.mock) testImplementation(libs.robolectric) } + +// Workaround https://github.com/cashapp/paparazzi/issues/1231 +plugins.withId("app.cash.paparazzi") { + // Defer until afterEvaluate so that testImplementation is created by Android plugin. + afterEvaluate { + dependencies.constraints { + add("testImplementation", "com.google.guava:guava") { + attributes { + attribute( + TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, + objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.STANDARD_JVM), + ) + } + because( + "LayoutLib and sdk-common depend on Guava's -jre published variant." + + "See https://github.com/cashapp/paparazzi/issues/906.", + ) + } + } + } +} diff --git a/cropper/src/main/kotlin/com/canhub/cropper/BitmapUtils.kt b/cropper/src/main/kotlin/com/canhub/cropper/BitmapUtils.kt index 26ed3304..aece8f42 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/BitmapUtils.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/BitmapUtils.kt @@ -128,35 +128,33 @@ internal object BitmapUtils { uri: Uri, reqWidth: Int, reqHeight: Int, - ): BitmapSampled { - return try { - val resolver = context.contentResolver - // First decode with inJustDecodeBounds=true to check dimensions - val options = decodeImageForOption(resolver, uri) - if (options.outWidth == -1 && options.outHeight == -1) throw RuntimeException("File is not a picture") - // Calculate inSampleSize - options.inSampleSize = max( - calculateInSampleSizeByRequestedSize( - width = options.outWidth, - height = options.outHeight, - reqWidth = reqWidth, - reqHeight = reqHeight, - ), - calculateInSampleSizeByMaxTextureSize( - width = options.outWidth, - height = options.outHeight, - ), - ) - // Decode bitmap with inSampleSize set - val bitmap = decodeImage( - resolver = resolver, - uri = uri, - options = options, - ) - BitmapSampled(bitmap, options.inSampleSize) - } catch (e: Exception) { - throw CropException.FailedToLoadBitmap(uri, e.message) - } + ): BitmapSampled = try { + val resolver = context.contentResolver + // First decode with inJustDecodeBounds=true to check dimensions + val options = decodeImageForOption(resolver, uri) + if (options.outWidth == -1 && options.outHeight == -1) throw RuntimeException("File is not a picture") + // Calculate inSampleSize + options.inSampleSize = max( + calculateInSampleSizeByRequestedSize( + width = options.outWidth, + height = options.outHeight, + reqWidth = reqWidth, + reqHeight = reqHeight, + ), + calculateInSampleSizeByMaxTextureSize( + width = options.outWidth, + height = options.outHeight, + ), + ) + // Decode bitmap with inSampleSize set + val bitmap = decodeImage( + resolver = resolver, + uri = uri, + options = options, + ) + BitmapSampled(bitmap, options.inSampleSize) + } catch (e: Exception) { + throw CropException.FailedToLoadBitmap(uri, e.message) } /** @@ -325,58 +323,42 @@ internal object BitmapUtils { /** * Get left value of the bounding rectangle of the given points. */ - fun getRectLeft(points: FloatArray): Float { - return min(min(min(points[0], points[2]), points[4]), points[6]) - } + fun getRectLeft(points: FloatArray): Float = min(min(min(points[0], points[2]), points[4]), points[6]) /** * Get top value of the bounding rectangle of the given points. */ - fun getRectTop(points: FloatArray): Float { - return min(min(min(points[1], points[3]), points[5]), points[7]) - } + fun getRectTop(points: FloatArray): Float = min(min(min(points[1], points[3]), points[5]), points[7]) /** * Get right value of the bounding rectangle of the given points. */ - fun getRectRight(points: FloatArray): Float { - return max(max(max(points[0], points[2]), points[4]), points[6]) - } + fun getRectRight(points: FloatArray): Float = max(max(max(points[0], points[2]), points[4]), points[6]) /** * Get bottom value of the bounding rectangle of the given points. */ - fun getRectBottom(points: FloatArray): Float { - return max(max(max(points[1], points[3]), points[5]), points[7]) - } + fun getRectBottom(points: FloatArray): Float = max(max(max(points[1], points[3]), points[5]), points[7]) /** * Get width of the bounding rectangle of the given points. */ - fun getRectWidth(points: FloatArray): Float { - return getRectRight(points) - getRectLeft(points) - } + fun getRectWidth(points: FloatArray): Float = getRectRight(points) - getRectLeft(points) /** * Get height of the bounding rectangle of the given points. */ - fun getRectHeight(points: FloatArray): Float { - return getRectBottom(points) - getRectTop(points) - } + fun getRectHeight(points: FloatArray): Float = getRectBottom(points) - getRectTop(points) /** * Get horizontal center value of the bounding rectangle of the given points. */ - fun getRectCenterX(points: FloatArray): Float { - return (getRectRight(points) + getRectLeft(points)) / 2f - } + fun getRectCenterX(points: FloatArray): Float = (getRectRight(points) + getRectLeft(points)) / 2f /** * Get vertical center value of the bounding rectangle of the given points. */ - fun getRectCenterY(points: FloatArray): Float { - return (getRectBottom(points) + getRectTop(points)) / 2f - } + fun getRectCenterY(points: FloatArray): Float = (getRectBottom(points) + getRectTop(points)) / 2f /** * Get a rectangle for the given 4 points (x0,y0,x1,y1,x2,y2,x3,y3) by finding the min/max 2 @@ -457,7 +439,7 @@ internal object BitmapUtils { ): Uri { val newUri = customOutputUri ?: buildUri(context, compressFormat) - return context.contentResolver.openOutputStream(newUri, WRITE_AND_TRUNCATE).use { + return context.contentResolver.openOutputStream(newUri, WRITE_AND_TRUNCATE)!!.use { bitmap.compress(compressFormat, compressQuality, it) newUri } @@ -701,14 +683,12 @@ internal object BitmapUtils { * Decode image from uri using "inJustDecodeBounds" to get the image dimensions. */ @Throws(FileNotFoundException::class) - private fun decodeImageForOption(resolver: ContentResolver, uri: Uri): BitmapFactory.Options { - return resolver.openInputStream(uri).use { - val options = BitmapFactory.Options() - options.inJustDecodeBounds = true - BitmapFactory.decodeStream(it, EMPTY_RECT, options) - options.inJustDecodeBounds = false - options - } + private fun decodeImageForOption(resolver: ContentResolver, uri: Uri): BitmapFactory.Options = resolver.openInputStream(uri).use { + val options = BitmapFactory.Options() + options.inJustDecodeBounds = true + BitmapFactory.decodeStream(it, EMPTY_RECT, options) + options.inJustDecodeBounds = false + options } /** @@ -790,14 +770,14 @@ internal object BitmapUtils { * Note: rotating by 0, 90, 180 or 270 degrees doesn't require extra cropping. */ private fun cropForRotatedImage( - bitmap: Bitmap?, + bitmap: Bitmap, cropPoints: FloatArray, rect: Rect, degreesRotated: Int, fixAspectRatio: Boolean, aspectRatioX: Int, aspectRatioY: Int, - ): Bitmap? { + ): Bitmap { var tempBitmap = bitmap if (degreesRotated % 90 != 0) { var adjLeft = 0 @@ -823,14 +803,14 @@ internal object BitmapUtils { } val bitmapTmp = tempBitmap tempBitmap = Bitmap.createBitmap( - bitmap!!, + bitmap, rect.left, rect.top, rect.width(), rect.height(), ) if (bitmapTmp != tempBitmap) { - bitmapTmp?.recycle() + bitmapTmp.recycle() } } return tempBitmap @@ -888,22 +868,20 @@ internal object BitmapUtils { degrees: Int, flipHorizontally: Boolean, flipVertically: Boolean, - ): Bitmap { - return if (degrees > 0 || flipHorizontally || flipVertically) { - val matrix = Matrix() - matrix.setRotate(degrees.toFloat()) - matrix.postScale( - (if (flipHorizontally) -1 else 1).toFloat(), - (if (flipVertically) -1 else 1).toFloat(), - ) - val newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, false) - if (newBitmap != bitmap) { - bitmap.recycle() - } - newBitmap - } else { - bitmap + ): Bitmap = if (degrees > 0 || flipHorizontally || flipVertically) { + val matrix = Matrix() + matrix.setRotate(degrees.toFloat()) + matrix.postScale( + (if (flipHorizontally) -1 else 1).toFloat(), + (if (flipVertically) -1 else 1).toFloat(), + ) + val newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, false) + if (newBitmap != bitmap) { + bitmap.recycle() } + newBitmap + } else { + bitmap } // Only need to check for width since opengl textures are always squared // Keep track of the maximum texture size diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImage.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImage.kt index 688dd18e..9ccca82e 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImage.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImage.kt @@ -74,7 +74,9 @@ object CropImage { /** * Result data of Crop Image Activity. */ - open class ActivityResult : CropResult, Parcelable { + open class ActivityResult : + CropResult, + Parcelable { constructor( originalUri: Uri?, diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImageActivity.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImageActivity.kt index 9bbe0bab..1c7ca52f 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImageActivity.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImageActivity.kt @@ -29,7 +29,10 @@ import com.canhub.cropper.databinding.CropImageActivityBinding import com.canhub.cropper.utils.getUriForFile import java.io.File -open class CropImageActivity : AppCompatActivity(), OnSetImageUriCompleteListener, OnCropImageCompleteListener { +open class CropImageActivity : + AppCompatActivity(), + OnSetImageUriCompleteListener, + OnCropImageCompleteListener { /** Persist URI image to crop URI if specific permissions are required. */ private var cropImageUri: Uri? = null diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImageAnimation.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImageAnimation.kt index 8a651830..42e72d3d 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImageAnimation.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImageAnimation.kt @@ -15,7 +15,8 @@ import android.widget.ImageView internal class CropImageAnimation( private val imageView: ImageView, private val cropOverlayView: CropOverlayView, -) : Animation(), AnimationListener { +) : Animation(), + AnimationListener { private val startBoundPoints = FloatArray(8) private val endBoundPoints = FloatArray(8) diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImageIntentChooser.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImageIntentChooser.kt index 29ba5963..c0ab2962 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImageIntentChooser.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImageIntentChooser.kt @@ -187,11 +187,9 @@ internal class CropImageIntentChooser( * See [StackOverflow * question](http://stackoverflow.com/questions/32789027/android-m-camera-intent-permission-bug). */ - private fun isExplicitCameraPermissionRequired(context: Context): Boolean { - return SDK_INT >= Build.VERSION_CODES.M && - hasCameraPermissionInManifest(context) && - context.checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED - } + private fun isExplicitCameraPermissionRequired(context: Context): Boolean = SDK_INT >= Build.VERSION_CODES.M && + hasCameraPermissionInManifest(context) && + context.checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED /** * Check if the app requests a specific permission in the manifest. diff --git a/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt b/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt index c30edd8e..5956e59c 100644 --- a/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt +++ b/cropper/src/main/kotlin/com/canhub/cropper/CropImageView.kt @@ -39,7 +39,8 @@ import kotlin.math.sqrt class CropImageView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, -) : FrameLayout(context, attrs), CropWindowChangeListener { +) : FrameLayout(context, attrs), + CropWindowChangeListener { /** Image view widget used to show the image for cropping. */ private val imageView: ImageView @@ -1756,15 +1757,13 @@ class CropImageView @JvmOverloads constructor( * * [context] used to retrieve the bitmap in case you need from activity result */ - fun getBitmap(context: Context): Bitmap? { - return bitmap ?: try { - when { - SDK_INT >= 28 -> ImageDecoder.decodeBitmap(ImageDecoder.createSource(context.contentResolver, uriContent!!)) - else -> @Suppress("DEPRECATION") MediaStore.Images.Media.getBitmap(context.contentResolver, uriContent) - } - } catch (e: Exception) { - null + fun getBitmap(context: Context): Bitmap? = bitmap ?: try { + when { + SDK_INT >= 28 -> ImageDecoder.decodeBitmap(ImageDecoder.createSource(context.contentResolver, uriContent!!)) + else -> @Suppress("DEPRECATION") MediaStore.Images.Media.getBitmap(context.contentResolver, uriContent) } + } catch (e: Exception) { + null } /** diff --git a/cropper/src/test/kotlin/com/canhub/cropper/ContractTestFragment.kt b/cropper/src/test/kotlin/com/canhub/cropper/ContractTestFragment.kt index a873d71e..c65da614 100644 --- a/cropper/src/test/kotlin/com/canhub/cropper/ContractTestFragment.kt +++ b/cropper/src/test/kotlin/com/canhub/cropper/ContractTestFragment.kt @@ -19,7 +19,5 @@ class ContractTestFragment( cropImage.launch(input) } - fun cropImageIntent(input: CropImageContractOptions): Intent { - return cropImage.contract.createIntent(requireContext(), input) - } + fun cropImageIntent(input: CropImageContractOptions): Intent = cropImage.contract.createIntent(requireContext(), input) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4117c87d..adf7657e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,36 +1,36 @@ [versions] minSdk = "21" -compileSdk = "33" -targetSdk = "33" +compileSdk = "34" +targetSdk = "34" -androidgradleplugin = "8.0.2" -kotlin = "1.8.22" -kotlinxcoroutines = "1.7.2" -ktlint = "0.50.0" +androidgradleplugin = "8.4.0" +kotlin = "1.9.24" +kotlinxcoroutines = "1.8.1" +ktlint = "1.2.1" [libraries] -androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.7.2" } +androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version = "1.9.0" } androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.6.1" } -androidx-core-ktx = { module = "androidx.core:core-ktx", version = "1.9.0" } -androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version = "1.3.6" } -androidx-fragment-testing = { module = "androidx.fragment:fragment-testing", version = "1.6.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" } 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.12" } -material = { module = "com.google.android.material:material", version = "1.9.0" } -mock = { module = "io.mockk:mockk", version = "1.13.5" } -plugin-android-cache-fix = { module = "org.gradle.android.cache-fix:org.gradle.android.cache-fix.gradle.plugin", version = "2.7.2" } +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" } +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.8.20" } +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.7.0" } -plugin-paparazzi = { module = "app.cash.paparazzi:paparazzi-gradle-plugin", version = "1.3.0" } -plugin-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.25.3" } -robolectric = { module = "org.robolectric:robolectric", version = "4.9" } +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" } +robolectric = { module = "org.robolectric:robolectric", version = "4.12.1" } timber = { module = "com.jakewharton.timber:timber", version = "5.0.1" } [plugins] -codequalitytools = { id = "com.vanniktech.code.quality.tools", version = "0.23.0" } +codequalitytools = { id = "com.vanniktech.code.quality.tools", version = "0.24.0" } dependencygraphgenerator = { id = "com.vanniktech.dependency.graph.generator", version = "0.8.0" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c4..e6441136 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bf01c4d1..e7646dea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca1..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# 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 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85b..7101f8e4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/sample/src/main/kotlin/com/canhub/cropper/sample/SampleCustomActivity.kt b/sample/src/main/kotlin/com/canhub/cropper/sample/SampleCustomActivity.kt index 9b33fcbe..28bb2474 100644 --- a/sample/src/main/kotlin/com/canhub/cropper/sample/SampleCustomActivity.kt +++ b/sample/src/main/kotlin/com/canhub/cropper/sample/SampleCustomActivity.kt @@ -59,7 +59,7 @@ internal class SampleCustomActivity : CropImageActivity() { binding.expectedImageSize.text = binding.cropImageView.expectedImageSize().toString() } - override fun setContentView(view: View) { + override fun setContentView(view: View?) { super.setContentView(binding.root) } diff --git a/sample/src/main/kotlin/com/canhub/cropper/sample/SampleUsingImageViewFragment.kt b/sample/src/main/kotlin/com/canhub/cropper/sample/SampleUsingImageViewFragment.kt index 18884578..e1b8d94f 100644 --- a/sample/src/main/kotlin/com/canhub/cropper/sample/SampleUsingImageViewFragment.kt +++ b/sample/src/main/kotlin/com/canhub/cropper/sample/SampleUsingImageViewFragment.kt @@ -23,7 +23,11 @@ import com.example.croppersample.R import com.example.croppersample.databinding.FragmentCropImageViewBinding import timber.log.Timber -internal class SampleUsingImageViewFragment : Fragment(), SampleOptionsBottomSheet.Listener, OnSetImageUriCompleteListener, OnCropImageCompleteListener { +internal class SampleUsingImageViewFragment : + Fragment(), + SampleOptionsBottomSheet.Listener, + OnSetImageUriCompleteListener, + OnCropImageCompleteListener { private var _binding: FragmentCropImageViewBinding? = null private val binding get() = _binding!!