From 6a5ef6973506448829a92ea1f0a93cac552abe2d Mon Sep 17 00:00:00 2001 From: Aleksei Arsenev Date: Wed, 30 Sep 2020 01:07:11 +0300 Subject: [PATCH 01/15] Add ru locale --- ucrop/src/main/res/values-ru/strings.xml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 ucrop/src/main/res/values-ru/strings.xml diff --git a/ucrop/src/main/res/values-ru/strings.xml b/ucrop/src/main/res/values-ru/strings.xml new file mode 100644 index 000000000..7973c3c92 --- /dev/null +++ b/ucrop/src/main/res/values-ru/strings.xml @@ -0,0 +1,9 @@ + + + Оригинал + Повернуть + Масштабировать + Обрезать + Обрезать + Редактировать фото + From d66d4aca5947252c14f892d87324359de1d6f612 Mon Sep 17 00:00:00 2001 From: dmorozov Date: Fri, 21 Jan 2022 14:42:06 +0200 Subject: [PATCH 02/15] Update compileSdk and targetSdk versions up to 31 Signed-off-by: dmorozov --- sample/build.gradle | 6 +++--- ucrop/build.gradle | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sample/build.gradle b/sample/build.gradle index 06f3e1bc7..ca64faed0 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 - buildToolsVersion '28.0.3' + compileSdkVersion 31 + buildToolsVersion '30.0.3' defaultConfig { applicationId "com.yalantis.ucrop.sample" minSdkVersion 14 - targetSdkVersion 29 + targetSdkVersion 31 versionCode 13 versionName "1.2.4" } diff --git a/ucrop/build.gradle b/ucrop/build.gradle index e1289e889..a3a3320b4 100644 --- a/ucrop/build.gradle +++ b/ucrop/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'com.android.library' apply from: '../mavenpush.gradle' android { - compileSdkVersion 28 - buildToolsVersion '28.0.3' + compileSdkVersion 31 + buildToolsVersion '30.0.2' defaultConfig { minSdkVersion 14 - targetSdkVersion 28 + targetSdkVersion 31 versionCode 26 versionName "2.2.5-native" From eabe0ef0cd3d08fe3b3dee0349f7ebfb7691512a Mon Sep 17 00:00:00 2001 From: Denys Alokhin Date: Fri, 21 Jan 2022 14:50:39 +0200 Subject: [PATCH 03/15] Fix launch of sample app on Android 12 --- sample/src/main/AndroidManifest.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 634aafa16..eb9f3a3d3 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -24,7 +24,8 @@ + android:screenOrientation="portrait" + android:exported="true"> From 784edd0104969c379d7938b56872e541dfd7ab76 Mon Sep 17 00:00:00 2001 From: dmorozov Date: Thu, 20 Jan 2022 18:11:30 +0200 Subject: [PATCH 04/15] Fix Vector drawable issue on Android 5.0 - Correct the vector drawable path due to bad rendering Signed-off-by: dmorozov --- ucrop/src/main/res/drawable/ucrop_ic_rotate.xml | 2 +- ucrop/src/main/res/drawable/ucrop_ic_rotate_unselected.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ucrop/src/main/res/drawable/ucrop_ic_rotate.xml b/ucrop/src/main/res/drawable/ucrop_ic_rotate.xml index 509d7b156..2c08c2285 100644 --- a/ucrop/src/main/res/drawable/ucrop_ic_rotate.xml +++ b/ucrop/src/main/res/drawable/ucrop_ic_rotate.xml @@ -7,5 +7,5 @@ + android:pathData="M 19.761,5.566 C 15.791825,0.49517195 7.1049248,0.96194642 3.7237612,6.4638227 -0.33837992,12.033745 3.3097107,20.843671 10.121424,21.908979 c 4.572019,1.06054 9.956288,-1.892196 11.2181,-6.246218 C 20.613349,15.378841 19.887175,15.09492 19.161,14.811 17.787681,18.760509 12.866024,20.703386 9.1288906,19.047063 5.9906393,17.775571 3.9999147,14.236171 4.5746701,10.893626 5.0470831,7.426033 8.1929546,4.5782223 11.692652,4.4629013 13.866935,4.33846 16.076584,5.2031434 17.571,6.791 c -0.89,0.4976667 -1.78,0.9953333 -2.67,1.493 2.321563,1.3826149 4.642896,2.765615 6.964,4.149 0.03752,-2.7019929 0.07452,-5.4039929 0.111,-8.106 -0.738333,0.413 -1.476667,0.826 -2.215,1.239 z" /> diff --git a/ucrop/src/main/res/drawable/ucrop_ic_rotate_unselected.xml b/ucrop/src/main/res/drawable/ucrop_ic_rotate_unselected.xml index 55f7a3ff9..841dc96ea 100644 --- a/ucrop/src/main/res/drawable/ucrop_ic_rotate_unselected.xml +++ b/ucrop/src/main/res/drawable/ucrop_ic_rotate_unselected.xml @@ -7,5 +7,5 @@ + android:pathData="M 19.761,5.566 C 15.791825,0.49517195 7.1049248,0.96194642 3.7237612,6.4638227 -0.33837992,12.033745 3.3097107,20.843671 10.121424,21.908979 c 4.572019,1.06054 9.956288,-1.892196 11.2181,-6.246218 C 20.613349,15.378841 19.887175,15.09492 19.161,14.811 17.787681,18.760509 12.866024,20.703386 9.1288906,19.047063 5.9906393,17.775571 3.9999147,14.236171 4.5746701,10.893626 5.0470831,7.426033 8.1929546,4.5782223 11.692652,4.4629013 13.866935,4.33846 16.076584,5.2031434 17.571,6.791 c -0.89,0.4976667 -1.78,0.9953333 -2.67,1.493 2.321563,1.3826149 4.642896,2.765615 6.964,4.149 0.03752,-2.7019929 0.07452,-5.4039929 0.111,-8.106 -0.738333,0.413 -1.476667,0.826 -2.215,1.239 z" /> From 9697ec54b99dbd43a7df81e8d5abd75b4e617700 Mon Sep 17 00:00:00 2001 From: Telephone <49133394+Telephone2019@users.noreply.github.com> Date: Fri, 12 Feb 2021 23:04:57 +0800 Subject: [PATCH 05/15] add zh locale strings --- ucrop/src/main/res/values-zh/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ucrop/src/main/res/values-zh/strings.xml b/ucrop/src/main/res/values-zh/strings.xml index fb39928db..100ef14ba 100644 --- a/ucrop/src/main/res/values-zh/strings.xml +++ b/ucrop/src/main/res/values-zh/strings.xml @@ -4,5 +4,8 @@ 裁剪 裁剪 + 旋转 + 缩放 + 裁剪 From 602066bab6234d228f5c4464c02e6c23a8cc95f3 Mon Sep 17 00:00:00 2001 From: riel Date: Thu, 10 Sep 2020 12:05:24 +0800 Subject: [PATCH 06/15] nl locale --- ucrop/src/main/res/values-nl/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ucrop/src/main/res/values-nl/strings.xml b/ucrop/src/main/res/values-nl/strings.xml index 4570a62f8..a9ca77d13 100644 --- a/ucrop/src/main/res/values-nl/strings.xml +++ b/ucrop/src/main/res/values-nl/strings.xml @@ -2,4 +2,8 @@ Origineel Foto bewerken Bijsnijden + + Draaien + Schalen + Bijsnijden From befdedb5624c98b84f24cdc05bbc2519a1d77166 Mon Sep 17 00:00:00 2001 From: Mohammad Omidvar Tehrani Date: Sat, 5 Sep 2020 11:47:29 +0430 Subject: [PATCH 07/15] Add Farsi (Persian) string translations --- ucrop/src/main/res/values-fa/strings.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ucrop/src/main/res/values-fa/strings.xml diff --git a/ucrop/src/main/res/values-fa/strings.xml b/ucrop/src/main/res/values-fa/strings.xml new file mode 100644 index 000000000..f0c81a008 --- /dev/null +++ b/ucrop/src/main/res/values-fa/strings.xml @@ -0,0 +1,13 @@ + + + + اصلی + ویرایش عکس + + برش + + چرخش + اندازه + برش + + From 18fa855f7c49fa06882ebb35c5f7c856957e65c2 Mon Sep 17 00:00:00 2001 From: Hendrik Druse Date: Tue, 2 Jun 2020 11:39:39 +0200 Subject: [PATCH 08/15] update german localization --- ucrop/src/main/res/values-de/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ucrop/src/main/res/values-de/strings.xml b/ucrop/src/main/res/values-de/strings.xml index 481d25a57..8d81cea75 100644 --- a/ucrop/src/main/res/values-de/strings.xml +++ b/ucrop/src/main/res/values-de/strings.xml @@ -3,4 +3,8 @@ Foto editieren Original Zuschneiden + + Rotieren + Skalieren + Zuschneiden \ No newline at end of file From dd7f41112476b9945390264fe69389425ce6e2cd Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Tue, 4 Jun 2019 12:06:59 +0800 Subject: [PATCH 09/15] feat(i18n): update Simplified and traditional Chinese language --- ucrop/src/main/res/values-zh-rTW/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ucrop/src/main/res/values-zh-rTW/strings.xml b/ucrop/src/main/res/values-zh-rTW/strings.xml index f0abcc71e..c55eb6294 100644 --- a/ucrop/src/main/res/values-zh-rTW/strings.xml +++ b/ucrop/src/main/res/values-zh-rTW/strings.xml @@ -7,5 +7,8 @@ 必須指定輸入以及輸出的 Uri 在你的 App 內覆寫顏色資源檔 (ucrop_color_toolbar_widget) 使 5.0 以前裝置正常運作 + 旋轉 + 縮放 + 裁切 From f48dfcdc5ae99754a4f1107f9048a8d2865c3481 Mon Sep 17 00:00:00 2001 From: Luis Vasquez Date: Fri, 17 Jul 2020 17:17:18 -0300 Subject: [PATCH 10/15] fix portuguese language file --- ucrop/src/main/res/{values-pt-br => values-pt/strings.xml} | 2 -- 1 file changed, 2 deletions(-) rename ucrop/src/main/res/{values-pt-br => values-pt/strings.xml} (50%) diff --git a/ucrop/src/main/res/values-pt-br b/ucrop/src/main/res/values-pt/strings.xml similarity index 50% rename from ucrop/src/main/res/values-pt-br rename to ucrop/src/main/res/values-pt/strings.xml index 9fea3b042..1e98d1d0c 100644 --- a/ucrop/src/main/res/values-pt-br +++ b/ucrop/src/main/res/values-pt/strings.xml @@ -5,8 +5,6 @@ Cortar - Uri de entrada e saída deve ser especificado - Portanto, substitua o recurso de cores (ucrop_color_toolbar_widget) no seu aplicativo para fazê-lo funcionar em dispositivos pré-L Girar Tamanho Cortar From 45fd588530858cdcca923b9fee2c375e4a03d3e5 Mon Sep 17 00:00:00 2001 From: Luis Vasquez Date: Fri, 17 Jul 2020 17:44:35 -0300 Subject: [PATCH 11/15] added google translated Thai, Indonesian and Turkish languages --- ucrop/src/main/res/values-in/strings.xml | 12 ++++++++++++ ucrop/src/main/res/values-th/strings.xml | 12 ++++++++++++ ucrop/src/main/res/values-tr/strings.xml | 12 ++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 ucrop/src/main/res/values-in/strings.xml create mode 100644 ucrop/src/main/res/values-th/strings.xml create mode 100644 ucrop/src/main/res/values-tr/strings.xml diff --git a/ucrop/src/main/res/values-in/strings.xml b/ucrop/src/main/res/values-in/strings.xml new file mode 100644 index 000000000..eddf03209 --- /dev/null +++ b/ucrop/src/main/res/values-in/strings.xml @@ -0,0 +1,12 @@ + + + Asli + Edit Foto + + Pangkas + + Memutar + Skala + Pangkas + + diff --git a/ucrop/src/main/res/values-th/strings.xml b/ucrop/src/main/res/values-th/strings.xml new file mode 100644 index 000000000..add5b5ebe --- /dev/null +++ b/ucrop/src/main/res/values-th/strings.xml @@ -0,0 +1,12 @@ + + + เป็นต้นฉบับ + แก้ไขรูปภาพ + + พืชผล + + หมุน + ขนาด + พืชผล + + diff --git a/ucrop/src/main/res/values-tr/strings.xml b/ucrop/src/main/res/values-tr/strings.xml new file mode 100644 index 000000000..097261675 --- /dev/null +++ b/ucrop/src/main/res/values-tr/strings.xml @@ -0,0 +1,12 @@ + + + Orijinal + Fotoğrafı Düzenle + + Kırp + + Döndürme + Ölçek + Kırp + + From a8aaa567021ea09f5802dcd237e1c25c55c93bf4 Mon Sep 17 00:00:00 2001 From: Johannes Puchberger Date: Tue, 10 Nov 2020 15:15:45 +0100 Subject: [PATCH 12/15] fix aspect ratio bugs - change fallback for EXTRA_ASPECT_RATIO_X and EXTRA_ASPECT_RATIO_Y to "-1" as "0" has special meaning - fix usage of useSourceImageAspectRatio (now properly hides mWrapperStateAspectRatio) - fix setTargetAspectRatio at processOptions due to Float.NaN (allows custom aspect ratio definitions with default ratio set to x=CropImageView.DEFAULT_ASPECT_RATIO and y=CropImageView.DEFAULT_ASPECT_RATIO) - fix sanity check at setAspectRatioOptions --- .../com/yalantis/ucrop/sample/SampleActivity.java | 4 +++- ucrop/src/main/java/com/yalantis/ucrop/UCrop.java | 4 ++-- .../main/java/com/yalantis/ucrop/UCropActivity.java | 13 +++++++------ .../main/java/com/yalantis/ucrop/UCropFragment.java | 13 +++++++------ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/sample/src/main/java/com/yalantis/ucrop/sample/SampleActivity.java b/sample/src/main/java/com/yalantis/ucrop/sample/SampleActivity.java index 153937f8d..a57566a51 100644 --- a/sample/src/main/java/com/yalantis/ucrop/sample/SampleActivity.java +++ b/sample/src/main/java/com/yalantis/ucrop/sample/SampleActivity.java @@ -349,12 +349,14 @@ Tune everything (ノ◕ヮ◕)ノ*:・゚✧ options.setActiveControlsWidgetColor(ContextCompat.getColor(this, R.color.your_color_res)); // Aspect ratio options - options.setAspectRatioOptions(1, + options.setAspectRatioOptions(2, new AspectRatio("WOW", 1, 2), new AspectRatio("MUCH", 3, 4), new AspectRatio("RATIO", CropImageView.DEFAULT_ASPECT_RATIO, CropImageView.DEFAULT_ASPECT_RATIO), new AspectRatio("SO", 16, 9), new AspectRatio("ASPECT", 1, 1)); + options.withAspectRatio(CropImageView.DEFAULT_ASPECT_RATIO, CropImageView.DEFAULT_ASPECT_RATIO); + options.useSourceImageAspectRatio(); */ diff --git a/ucrop/src/main/java/com/yalantis/ucrop/UCrop.java b/ucrop/src/main/java/com/yalantis/ucrop/UCrop.java index e28fd5bc9..83e1bcc53 100644 --- a/ucrop/src/main/java/com/yalantis/ucrop/UCrop.java +++ b/ucrop/src/main/java/com/yalantis/ucrop/UCrop.java @@ -517,9 +517,9 @@ public void setFreeStyleCropEnabled(boolean enabled) { * @param aspectRatio - list of aspect ratio options that are available to user */ public void setAspectRatioOptions(int selectedByDefault, AspectRatio... aspectRatio) { - if (selectedByDefault > aspectRatio.length) { + if (selectedByDefault >= aspectRatio.length) { throw new IllegalArgumentException(String.format(Locale.US, - "Index [selectedByDefault = %d] cannot be higher than aspect ratio options count [count = %d].", + "Index [selectedByDefault = %d] (0-based) cannot be higher or equal than aspect ratio options count [count = %d].", selectedByDefault, aspectRatio.length)); } mOptionBundle.putInt(EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, selectedByDefault); diff --git a/ucrop/src/main/java/com/yalantis/ucrop/UCropActivity.java b/ucrop/src/main/java/com/yalantis/ucrop/UCropActivity.java index 0b32aafe8..3e12b38bb 100644 --- a/ucrop/src/main/java/com/yalantis/ucrop/UCropActivity.java +++ b/ucrop/src/main/java/com/yalantis/ucrop/UCropActivity.java @@ -256,20 +256,21 @@ private void processOptions(@NonNull Intent intent) { mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width))); // Aspect ratio options - float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, 0); - float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, 0); + float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, -1); + float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, -1); int aspectRationSelectedByDefault = intent.getIntExtra(UCrop.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0); ArrayList aspectRatioList = intent.getParcelableArrayListExtra(UCrop.Options.EXTRA_ASPECT_RATIO_OPTIONS); - if (aspectRatioX > 0 && aspectRatioY > 0) { + if (aspectRatioX >= 0 && aspectRatioY >= 0) { if (mWrapperStateAspectRatio != null) { mWrapperStateAspectRatio.setVisibility(View.GONE); } - mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY); + float targetAspectRatio = aspectRatioX / aspectRatioY; + mGestureCropImageView.setTargetAspectRatio(Float.isNaN(targetAspectRatio) ? CropImageView.SOURCE_IMAGE_ASPECT_RATIO : targetAspectRatio); } else if (aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList.size()) { - mGestureCropImageView.setTargetAspectRatio(aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() / - aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY()); + float targetAspectRatio = aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() / aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY(); + mGestureCropImageView.setTargetAspectRatio(Float.isNaN(targetAspectRatio) ? CropImageView.SOURCE_IMAGE_ASPECT_RATIO : targetAspectRatio); } else { mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO); } diff --git a/ucrop/src/main/java/com/yalantis/ucrop/UCropFragment.java b/ucrop/src/main/java/com/yalantis/ucrop/UCropFragment.java index 8ceea611b..56b8e25ec 100644 --- a/ucrop/src/main/java/com/yalantis/ucrop/UCropFragment.java +++ b/ucrop/src/main/java/com/yalantis/ucrop/UCropFragment.java @@ -237,20 +237,21 @@ private void processOptions(@NonNull Bundle bundle) { mOverlayView.setCropGridStrokeWidth(bundle.getInt(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width))); // Aspect ratio options - float aspectRatioX = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_X, 0); - float aspectRatioY = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_Y, 0); + float aspectRatioX = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_X, -1); + float aspectRatioY = bundle.getFloat(UCrop.EXTRA_ASPECT_RATIO_Y, -1); int aspectRationSelectedByDefault = bundle.getInt(UCrop.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0); ArrayList aspectRatioList = bundle.getParcelableArrayList(UCrop.Options.EXTRA_ASPECT_RATIO_OPTIONS); - if (aspectRatioX > 0 && aspectRatioY > 0) { + if (aspectRatioX >= 0 && aspectRatioY >= 0) { if (mWrapperStateAspectRatio != null) { mWrapperStateAspectRatio.setVisibility(View.GONE); } - mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY); + float targetAspectRatio = aspectRatioX / aspectRatioY; + mGestureCropImageView.setTargetAspectRatio(Float.isNaN(targetAspectRatio) ? CropImageView.SOURCE_IMAGE_ASPECT_RATIO : targetAspectRatio); } else if (aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList.size()) { - mGestureCropImageView.setTargetAspectRatio(aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() / - aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY()); + float targetAspectRatio = aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() / aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY(); + mGestureCropImageView.setTargetAspectRatio(Float.isNaN(targetAspectRatio) ? CropImageView.SOURCE_IMAGE_ASPECT_RATIO : targetAspectRatio); } else { mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO); } From 4cc5291bae1bdea0c6e95f1ac54cda5e18d4b80f Mon Sep 17 00:00:00 2001 From: "Dr.jacky" Date: Wed, 18 Nov 2020 16:12:36 +0000 Subject: [PATCH 13/15] Improve readme --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index bb5706d80..323185f22 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Get it on Google Play -1. Include the library as local library project. +1. Include the library as a local library project. ``` allprojects { @@ -25,9 +25,9 @@ ``` ``` implementation 'com.github.yalantis:ucrop:2.2.6' ``` - lightweight general solution - + ``` implementation 'com.github.yalantis:ucrop:2.2.6-native' ``` - get power of the native code to preserve image quality (+ about 1.5 MB to an apk size) - + 2. Add UCropActivity into your AndroidManifest.xml ``` @@ -73,24 +73,24 @@ If you want to let your users choose crop ratio dynamically, just do not call `w uCrop builder class has method `withOptions(UCrop.Options options)` which extends library configurations. -Currently you can change: +Currently, you can change: * image compression format (e.g. PNG, JPEG, WEBP), compression * image compression quality [0 - 100]. PNG which is lossless, will ignore the quality setting. * whether all gestures are enabled simultaneously - * maximum size for Bitmap that is decoded from source Uri and used within crop view. If you want to override default behaviour. + * maximum size for Bitmap that is decoded from source Uri and used within crop view. If you want to override the default behaviour. * toggle whether to show crop frame/guidelines * setup color/width/count of crop frame/rows/columns - * choose whether you want rectangle or oval crop area + * choose whether you want rectangle or oval(`options.setCircleDimmedLayer(true)`) crop area * the UI colors (Toolbar, StatusBar, active widget state) * and more... - + # Compatibility - + * Library - Android ICS 4.0+ (API 14) (Android GINGERBREAD 2.3+ (API 10) for versions <= 1.3.2) * Sample - Android ICS 4.0+ (API 14) * CPU - armeabi armeabi-v7a x86 x86_64 arm64-v8a (for versions >= 2.1.2) - + # Changelog ### Version: 2.2.5 @@ -106,13 +106,13 @@ Currently you can change: * **AndroidX migration** * Redesign * Several fixes including [#550](https://github.com/Yalantis/uCrop/issues/550) - + ### Version: 2.2.3 - * Several fixes including [#445](https://github.com/Yalantis/uCrop/issues/445), [#465](https://github.com/Yalantis/uCrop/issues/465) and more! - * Material design support + * Several fixes including [#445](https://github.com/Yalantis/uCrop/issues/445), [#465](https://github.com/Yalantis/uCrop/issues/465) and more! + * Material design support * uCrop fragment as child fragment - * Added Italian language + * Added the Italian language ### Version: 2.2.2 @@ -131,7 +131,7 @@ Currently you can change: ### Version: 2.1 * Fixes issue with EXIF data (images taken on front camera with Samsung devices mostly) [#130](https://github.com/Yalantis/uCrop/issues/130) [#111](https://github.com/Yalantis/uCrop/issues/111) - * Added API to set custom set of aspect ratio options for user. [#131](https://github.com/Yalantis/uCrop/issues/131) + * Added API to set custom set of aspect ratio options for the user. [#131](https://github.com/Yalantis/uCrop/issues/131) * Added API to set all configs via UCrop.Options class. [#126](https://github.com/Yalantis/uCrop/issues/126) * Added ABI x86_64 support. [#105](https://github.com/Yalantis/uCrop/issues/105) @@ -140,7 +140,7 @@ Currently you can change: * Native image crop (able to crop high-resolution images, e.g. 16MP & 32MP images on Nexus 5X). * WebP compression format is not supported at the moment (choose JPEG or PNG). * Now library copies EXIF data to cropped image (size and orientation are updated). - + ### Version: 1.5 * Introduced "Freestyle" crop (you can resize crop rectangle by dragging it corners) [#32](https://github.com/Yalantis/uCrop/issues/32) @@ -149,8 +149,8 @@ Currently you can change: ### Version: 1.4 - * Introduced http(s) Uri support! - * Image is cropped in background thread. + * Introduced HTTP(s) Uri support! + * Image is cropped in a background thread. * Showing loader while Bitmap is processed (both loading and cropping). * Several bug fixes. * Couple new things to configure. @@ -158,12 +158,12 @@ Currently you can change: ### Version: 1.3 - * Image is loaded in background thread. Better error-handling for image decoding. + * Image is loaded in a background thread. Better error-handling for image decoding. * Improved EXIF data support (rotation and mirror). * Small UI updates. * Couple new things to configure. - - * Sample updated with possibility to choose custom aspect ratio. + + * Sample updated with the possibility to choose custom aspect ratio. ### Version: 1.2 @@ -179,7 +179,7 @@ Currently you can change: ### Let us know! -We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the library. +We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the library. #### Apps using uCrop From 037ac7785a671e999f70f35975533bdde74647dc Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 20 May 2021 11:16:43 +0300 Subject: [PATCH 14/15] Added ability to set custom OkHttpClient for image downloading Updated okhttp dependency for uCrop Added custom OkHttpClient for sample due to outdated random pic url --- sample/build.gradle | 1 + sample/src/main/AndroidManifest.xml | 1 + .../com/yalantis/ucrop/sample/SampleApp.java | 32 +++++++++++++++++++ ucrop/build.gradle | 3 +- .../yalantis/ucrop/UCropHttpClientStore.java | 26 +++++++++++++++ .../yalantis/ucrop/task/BitmapLoadTask.java | 7 ++-- 6 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 sample/src/main/java/com/yalantis/ucrop/sample/SampleApp.java create mode 100644 ucrop/src/main/java/com/yalantis/ucrop/UCropHttpClientStore.java diff --git a/sample/build.gradle b/sample/build.gradle index ca64faed0..3b19d11b7 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -38,5 +38,6 @@ dependencies { implementation "androidx.appcompat:appcompat:${androidx_appcompat_version}" implementation "androidx.core:core:${androidx_core_version}" implementation "androidx.constraintlayout:constraintlayout:${constraintlayout_version}" + implementation "com.squareup.okhttp3:okhttp:3.12.13" implementation project(':ucrop') } \ No newline at end of file diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index eb9f3a3d3..a9d0c2e53 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ Date: Tue, 7 Jan 2020 11:44:33 +0530 Subject: [PATCH 15/15] Added functionality to enable/disable gestures in GestureCropImageView --- .../yalantis/ucrop/view/GestureCropImageView.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ucrop/src/main/java/com/yalantis/ucrop/view/GestureCropImageView.java b/ucrop/src/main/java/com/yalantis/ucrop/view/GestureCropImageView.java index b0f3cff93..e3644e184 100644 --- a/ucrop/src/main/java/com/yalantis/ucrop/view/GestureCropImageView.java +++ b/ucrop/src/main/java/com/yalantis/ucrop/view/GestureCropImageView.java @@ -21,7 +21,7 @@ public class GestureCropImageView extends CropImageView { private float mMidPntX, mMidPntY; - private boolean mIsRotateEnabled = true, mIsScaleEnabled = true; + private boolean mIsRotateEnabled = true, mIsScaleEnabled = true, mIsGestureEnabled = true; private int mDoubleTapScaleSteps = 5; public GestureCropImageView(Context context) { @@ -52,6 +52,14 @@ public boolean isRotateEnabled() { return mIsRotateEnabled; } + public void setGestureEnabled(boolean gestureEnabled) { + mIsGestureEnabled = gestureEnabled; + } + + public boolean isGestureEnabled() { + return mIsGestureEnabled; + } + public void setDoubleTapScaleSteps(int doubleTapScaleSteps) { mDoubleTapScaleSteps = doubleTapScaleSteps; } @@ -77,7 +85,9 @@ public boolean onTouchEvent(MotionEvent event) { mMidPntY = (event.getY(0) + event.getY(1)) / 2; } - mGestureDetector.onTouchEvent(event); + if (mIsGestureEnabled) { + mGestureDetector.onTouchEvent(event); + } if (mIsScaleEnabled) { mScaleDetector.onTouchEvent(event);