From 17d6aca1d70969c822b7689404a401bcb995b538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Valkovi=C4=8D?= Date: Mon, 21 Sep 2020 14:31:09 +0200 Subject: [PATCH] Migrate to AndroidX --- build.gradle | 8 ++++--- gradle.properties | 3 ++- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 10 ++++---- .../com/steelkiwi/cropiwa/AspectRatio.java | 2 +- .../steelkiwi/cropiwa/CropIwaImageView.java | 2 +- .../steelkiwi/cropiwa/CropIwaOverlayView.java | 2 +- .../config/CropIwaImageViewConfig.java | 2 +- .../cropiwa/config/CropIwaOverlayConfig.java | 4 ++-- .../cropiwa/config/CropIwaSaveConfig.java | 2 +- .../cropiwa/image/CropIwaBitmapManager.java | 4 ++-- .../cropiwa/shape/CropIwaOvalShape.java | 2 +- .../steelkiwi/cropiwa/util/CropIwaUtils.java | 4 ++-- .../com/steelkiwi/cropiwa/util/ResUtil.java | 8 +++---- sample/build.gradle | 24 +++++++++++-------- .../cropiwa/sample/CropActivity.java | 7 +++--- .../cropiwa/sample/CropGalleryActivity.java | 10 ++++---- .../cropiwa/sample/ViewImageActivity.java | 6 ++--- .../adapter/AspectRatioPreviewAdapter.java | 2 +- .../sample/adapter/CropGalleryAdapter.java | 2 +- .../sample/config/CropViewConfigurator.java | 4 ++-- .../cropiwa/sample/data/CropGallery.java | 2 +- .../fragment/ChooseImageForCropFragment.java | 6 ++--- .../fragment/ConfirmDeletePhotoFragment.java | 4 ++-- .../cropiwa/sample/util/Permissions.java | 2 +- .../cropiwa/sample/view/SquareLayout.java | 2 +- sample/src/main/res/layout/activity_crop.xml | 4 ++-- .../main/res/layout/activity_crop_gallery.xml | 10 ++++---- .../main/res/layout/pref_card_crop_mode.xml | 2 +- sample/src/main/res/layout/toolbar.xml | 2 +- 30 files changed, 75 insertions(+), 69 deletions(-) diff --git a/build.gradle b/build.gradle index 39efa41..073e833 100644 --- a/build.gradle +++ b/build.gradle @@ -2,16 +2,18 @@ buildscript { repositories { + google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.3' - classpath 'com.novoda:bintray-release:0.4.0' + classpath 'com.android.tools.build:gradle:4.0.1' + classpath 'com.novoda:bintray-release:0.5.0' } } allprojects { repositories { + google() jcenter() } } @@ -25,7 +27,7 @@ ext { groupId = 'com.steelkiwi' uploadName = 'cropiwa' description = 'Configurable Custom Crop widget for Android' - publishVersion = '1.0.3' + publishVersion = '2.0.0' licences = ['Apache-2.0'] } diff --git a/gradle.properties b/gradle.properties index 1d3591c..ccd5dda 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,5 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c62d758..63e9eb2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index b538503..19a98d3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'com.android.library' apply plugin: 'com.novoda.bintray-release' android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 30 + buildToolsVersion "30.0.2" defaultConfig { minSdkVersion 16 - targetSdkVersion 25 + targetSdkVersion 30 versionCode 1 versionName "1.0" } @@ -20,8 +20,8 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:25.1.0' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.2.0' } publish { diff --git a/library/src/main/java/com/steelkiwi/cropiwa/AspectRatio.java b/library/src/main/java/com/steelkiwi/cropiwa/AspectRatio.java index b10bba5..ca03ada 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/AspectRatio.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/AspectRatio.java @@ -1,6 +1,6 @@ package com.steelkiwi.cropiwa; -import android.support.annotation.IntRange; +import androidx.annotation.IntRange; /** * Created by yarolegovich https://github.com/yarolegovich diff --git a/library/src/main/java/com/steelkiwi/cropiwa/CropIwaImageView.java b/library/src/main/java/com/steelkiwi/cropiwa/CropIwaImageView.java index ca47437..c5cae57 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/CropIwaImageView.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/CropIwaImageView.java @@ -6,7 +6,7 @@ import android.graphics.Matrix; import android.graphics.RectF; import android.graphics.drawable.Drawable; -import android.support.annotation.FloatRange; +import androidx.annotation.FloatRange; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.widget.ImageView; diff --git a/library/src/main/java/com/steelkiwi/cropiwa/CropIwaOverlayView.java b/library/src/main/java/com/steelkiwi/cropiwa/CropIwaOverlayView.java index 22f1e28..d37d8f6 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/CropIwaOverlayView.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/CropIwaOverlayView.java @@ -5,7 +5,7 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.view.MotionEvent; import android.view.View; diff --git a/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaImageViewConfig.java b/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaImageViewConfig.java index 4a0a94f..bfe0449 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaImageViewConfig.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaImageViewConfig.java @@ -2,7 +2,7 @@ import android.content.Context; import android.content.res.TypedArray; -import android.support.annotation.FloatRange; +import androidx.annotation.FloatRange; import android.util.AttributeSet; import com.steelkiwi.cropiwa.R; diff --git a/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaOverlayConfig.java b/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaOverlayConfig.java index a17de3e..f41b5f8 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaOverlayConfig.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaOverlayConfig.java @@ -2,8 +2,8 @@ import android.content.Context; import android.content.res.TypedArray; -import android.support.annotation.FloatRange; -import android.support.annotation.NonNull; +import androidx.annotation.FloatRange; +import androidx.annotation.NonNull; import android.util.AttributeSet; import com.steelkiwi.cropiwa.AspectRatio; diff --git a/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaSaveConfig.java b/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaSaveConfig.java index c6de5dd..4581bd4 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaSaveConfig.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/config/CropIwaSaveConfig.java @@ -2,7 +2,7 @@ import android.graphics.Bitmap; import android.net.Uri; -import android.support.annotation.IntRange; +import androidx.annotation.IntRange; import com.steelkiwi.cropiwa.image.CropIwaBitmapManager; /** diff --git a/library/src/main/java/com/steelkiwi/cropiwa/image/CropIwaBitmapManager.java b/library/src/main/java/com/steelkiwi/cropiwa/image/CropIwaBitmapManager.java index 8b6cb7b..a1e8634 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/image/CropIwaBitmapManager.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/image/CropIwaBitmapManager.java @@ -6,8 +6,8 @@ import android.graphics.Matrix; import android.media.ExifInterface; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.steelkiwi.cropiwa.OnCroppedListener; import com.steelkiwi.cropiwa.config.CropIwaSaveConfig; diff --git a/library/src/main/java/com/steelkiwi/cropiwa/shape/CropIwaOvalShape.java b/library/src/main/java/com/steelkiwi/cropiwa/shape/CropIwaOvalShape.java index dbad589..c510125 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/shape/CropIwaOvalShape.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/shape/CropIwaOvalShape.java @@ -42,7 +42,7 @@ protected void drawGrid(Canvas canvas, RectF cropBounds, Paint paint) { clipPath.rewind(); clipPath.addOval(cropBounds, Path.Direction.CW); - canvas.save(Canvas.CLIP_SAVE_FLAG); + canvas.save(); canvas.clipPath(clipPath); super.drawGrid(canvas, cropBounds, paint); canvas.restore(); diff --git a/library/src/main/java/com/steelkiwi/cropiwa/util/CropIwaUtils.java b/library/src/main/java/com/steelkiwi/cropiwa/util/CropIwaUtils.java index e17d026..8b60fa9 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/util/CropIwaUtils.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/util/CropIwaUtils.java @@ -2,8 +2,8 @@ import android.content.res.Resources; import android.graphics.RectF; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.DisplayMetrics; import java.io.Closeable; diff --git a/library/src/main/java/com/steelkiwi/cropiwa/util/ResUtil.java b/library/src/main/java/com/steelkiwi/cropiwa/util/ResUtil.java index 53929c6..d87f9b4 100644 --- a/library/src/main/java/com/steelkiwi/cropiwa/util/ResUtil.java +++ b/library/src/main/java/com/steelkiwi/cropiwa/util/ResUtil.java @@ -1,10 +1,10 @@ package com.steelkiwi.cropiwa.util; import android.content.Context; -import android.support.annotation.ColorInt; -import android.support.annotation.ColorRes; -import android.support.annotation.DimenRes; -import android.support.v4.content.ContextCompat; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; +import androidx.annotation.DimenRes; +import androidx.core.content.ContextCompat; /** * @author yarolegovich https://github.com/yarolegovich diff --git a/sample/build.gradle b/sample/build.gradle index 4522afb..9896d3a 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,13 +1,17 @@ apply plugin: 'com.android.application' +repositories { + maven { url "https://jitpack.io" } +} + android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion 30 + buildToolsVersion "30.0.2" defaultConfig { applicationId "com.steelkiwi.cropiwa.sample" minSdkVersion 21 - targetSdkVersion 25 + targetSdkVersion 30 versionCode 1 versionName "1.0" } @@ -20,12 +24,12 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':library') - compile 'com.android.support:recyclerview-v7:25.1.0' - compile 'com.android.support:design:25.1.0' - compile 'com.android.support:appcompat-v7:25.1.0' - compile 'com.yarolegovich:mp:1.0.5' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':library') + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'com.google.android.material:material:1.2.1' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.yarolegovich:mp:1.1.6' - compile 'com.github.bumptech.glide:glide:3.7.0' + implementation 'com.github.bumptech.glide:glide:4.11.0' } diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropActivity.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropActivity.java index b599d96..1f0f4da 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropActivity.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropActivity.java @@ -4,12 +4,11 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; -import com.steelkiwi.cropiwa.AspectRatio; import com.steelkiwi.cropiwa.CropIwaView; import com.steelkiwi.cropiwa.sample.config.CropViewConfigurator; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropGalleryActivity.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropGalleryActivity.java index a6ec0b3..dfe38df 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropGalleryActivity.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/CropGalleryActivity.java @@ -2,11 +2,11 @@ import android.net.Uri; import android.os.Bundle; -import android.support.design.widget.Snackbar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; +import com.google.android.material.snackbar.Snackbar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.appcompat.widget.Toolbar; import android.view.View; import com.steelkiwi.cropiwa.image.CropIwaResultReceiver; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/ViewImageActivity.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/ViewImageActivity.java index 60b95fe..dc862b0 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/ViewImageActivity.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/ViewImageActivity.java @@ -4,9 +4,9 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import android.view.MenuItem; import android.widget.ImageView; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/AspectRatioPreviewAdapter.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/AspectRatioPreviewAdapter.java index 76cbc8f..b250326 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/AspectRatioPreviewAdapter.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/AspectRatioPreviewAdapter.java @@ -1,6 +1,6 @@ package com.steelkiwi.cropiwa.sample.adapter; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/CropGalleryAdapter.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/CropGalleryAdapter.java index 9246fc4..9750d07 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/CropGalleryAdapter.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/adapter/CropGalleryAdapter.java @@ -4,7 +4,7 @@ import android.app.ActivityOptions; import android.content.Intent; import android.net.Uri; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/config/CropViewConfigurator.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/config/CropViewConfigurator.java index 678cc5f..58ed087 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/config/CropViewConfigurator.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/config/CropViewConfigurator.java @@ -5,8 +5,8 @@ import android.graphics.Paint; import android.graphics.PathEffect; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.View; import com.steelkiwi.cropiwa.AspectRatio; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/data/CropGallery.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/data/CropGallery.java index 4e0e0c7..235a424 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/data/CropGallery.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/data/CropGallery.java @@ -1,7 +1,7 @@ package com.steelkiwi.cropiwa.sample.data; import android.net.Uri; -import android.support.annotation.DrawableRes; +import androidx.annotation.DrawableRes; import com.steelkiwi.cropiwa.sample.App; import com.steelkiwi.cropiwa.sample.R; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ChooseImageForCropFragment.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ChooseImageForCropFragment.java index 3067916..9b50d3e 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ChooseImageForCropFragment.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ChooseImageForCropFragment.java @@ -6,9 +6,9 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.design.widget.BottomSheetDialogFragment; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ConfirmDeletePhotoFragment.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ConfirmDeletePhotoFragment.java index ea70016..ea011bb 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ConfirmDeletePhotoFragment.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/fragment/ConfirmDeletePhotoFragment.java @@ -2,8 +2,8 @@ import android.net.Uri; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.design.widget.BottomSheetDialogFragment; +import androidx.annotation.Nullable; +import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/util/Permissions.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/util/Permissions.java index 3393afa..ebe3e30 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/util/Permissions.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/util/Permissions.java @@ -2,7 +2,7 @@ import android.app.Activity; import android.content.pm.PackageManager; -import android.support.v4.app.ActivityCompat; +import androidx.core.app.ActivityCompat; /** * Created by yarolegovich https://github.com/yarolegovich diff --git a/sample/src/main/java/com/steelkiwi/cropiwa/sample/view/SquareLayout.java b/sample/src/main/java/com/steelkiwi/cropiwa/sample/view/SquareLayout.java index 9849682..96362fc 100644 --- a/sample/src/main/java/com/steelkiwi/cropiwa/sample/view/SquareLayout.java +++ b/sample/src/main/java/com/steelkiwi/cropiwa/sample/view/SquareLayout.java @@ -2,7 +2,7 @@ import android.content.Context; import android.os.Build; -import android.support.annotation.RequiresApi; +import androidx.annotation.RequiresApi; import android.util.AttributeSet; import android.widget.FrameLayout; diff --git a/sample/src/main/res/layout/activity_crop.xml b/sample/src/main/res/layout/activity_crop.xml index f39849d..7a232c9 100644 --- a/sample/src/main/res/layout/activity_crop.xml +++ b/sample/src/main/res/layout/activity_crop.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - @@ -19,7 +19,7 @@ android:layout_weight="1" app:ci_dynamic_aspect_ratio="false" /> - + - - - + - - + diff --git a/sample/src/main/res/layout/pref_card_crop_mode.xml b/sample/src/main/res/layout/pref_card_crop_mode.xml index 4908818..cf9ebe2 100644 --- a/sample/src/main/res/layout/pref_card_crop_mode.xml +++ b/sample/src/main/res/layout/pref_card_crop_mode.xml @@ -21,7 +21,7 @@ app:mp_key="@string/key_dynamic_crop" app:mp_title="Dynamic overlay" /> - diff --git a/sample/src/main/res/layout/toolbar.xml b/sample/src/main/res/layout/toolbar.xml index 6d00ffe..12e2e64 100644 --- a/sample/src/main/res/layout/toolbar.xml +++ b/sample/src/main/res/layout/toolbar.xml @@ -1,5 +1,5 @@ -