diff --git a/app/build.gradle b/app/build.gradle index 7469317..e30e100 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,9 +10,10 @@ android { targetSdkVersion 28 // 1.0.0.190425 (1) initial version - versionCode 1 - versionName "1.0.0.190425" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + // 1.0.1.190507 (2) Bugfix: missing read permission; port to android-x + versionCode 2 + versionName "1.0.1.190507" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // all supported locales. Note: the lib has more translations which are supressed here // resConfigs "ar","de","es","fr","hi","in","it","ja","nl","pl","ro","ru","tr","uk","zz","pt-rBR","zh-rCN","zh-rTW" @@ -35,14 +36,13 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - // implementation "com.android.support:appcompat-v7:$support" - implementation "com.android.support:support-v4:$support" - implementation "com.android.support:support-annotations:$support" + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.annotation:annotation:1.0.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test:runner:1.1.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' // implements lossless croppig // implementation 'com.facebook.spectrum:spectrum-default:1.0.0' implementation 'com.facebook.spectrum:spectrum-core:1.0.0' diff --git a/app/src/androidTest/java/de/k3b/android/lossless_jpg_crop/ExampleInstrumentedTest.java b/app/src/androidTest/java/de/k3b/android/lossless_jpg_crop/ExampleInstrumentedTest.java index aec2e61..87ef8e0 100644 --- a/app/src/androidTest/java/de/k3b/android/lossless_jpg_crop/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/de/k3b/android/lossless_jpg_crop/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package de.k3b.android.lossless_jpg_crop; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 832eeac..a3bbae3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,7 +16,7 @@ android:theme="@style/AppTheme"> diff --git a/app/src/main/java/de/k3b/android/lossless_jpg_crop/BaseActivity.java b/app/src/main/java/de/k3b/android/lossless_jpg_crop/BaseActivity.java index 19422aa..5c7cef8 100644 --- a/app/src/main/java/de/k3b/android/lossless_jpg_crop/BaseActivity.java +++ b/app/src/main/java/de/k3b/android/lossless_jpg_crop/BaseActivity.java @@ -3,9 +3,9 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.ActivityCompat; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.app.ActivityCompat; /** * Created by Oleksii Shliama (https://github.com/shliama). diff --git a/app/src/main/java/de/k3b/android/lossless_jpg_crop/CropAreasChooseActivity.java b/app/src/main/java/de/k3b/android/lossless_jpg_crop/CropAreasChooseActivity.java index d49ca9e..4e6b682 100644 --- a/app/src/main/java/de/k3b/android/lossless_jpg_crop/CropAreasChooseActivity.java +++ b/app/src/main/java/de/k3b/android/lossless_jpg_crop/CropAreasChooseActivity.java @@ -1,16 +1,14 @@ package de.k3b.android.lossless_jpg_crop; import android.Manifest; -import android.app.Activity; -import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Rect; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.FileProvider; +import androidx.core.app.ActivityCompat; +import androidx.core.content.FileProvider; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -24,8 +22,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; - -import static android.content.Intent.EXTRA_STREAM; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; public class CropAreasChooseActivity extends BaseActivity { private static final String TAG = "llCrop"; @@ -178,6 +177,7 @@ private void onGetPictureResult(int resultCode, Intent data) { Intent intent = new Intent(Intent.ACTION_VIEW, selectedUri, this, CropAreasChooseActivity.class); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + this.startActivity(intent); finish(); return; @@ -230,13 +230,19 @@ private void onOpenPublicOutputUriPickerResult(int resultCode, Uri outUri) { InputStream inStream = null; OutputStream outStream = null; - final String context_message = "Cropping '" + inUri + "'(" + rect + ") => '" + outUri + "'"; + final String context_message = "Cropping '" + inUri + "'(" + rect + ") => '" + + outUri + "' ('" + toString(outUri) + "')"; Log.i(TAG, context_message); try { inStream = getContentResolver().openInputStream(inUri); outStream = getContentResolver().openOutputStream(outUri, "w"); this.mSpectrum.crop(inStream, outStream, rect, 0); + + String message = getString(R.string.toast_saved_as, + toString(outUri)); + Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); + finish(); return; } catch (Exception e) { @@ -251,6 +257,15 @@ private void onOpenPublicOutputUriPickerResult(int resultCode, Uri outUri) { } } + private String toString(Uri outUri) { + if (outUri == null) return ""; + try { + return URLDecoder.decode(outUri.toString(), StandardCharsets.UTF_8.toString()); + } catch (UnsupportedEncodingException e) { + return outUri.toString(); + } + } + private static void close(Closeable stream, Object source) { if (stream != null) { try { diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index fddb1b7..9201bed 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -8,4 +8,5 @@ Benötige Datei-Schreibrechte um ein Photo zu speichern. Beende app: Kein Quell Photo ausgewählt + Gespeichert als \'%1$s\' diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bc48562..6a74b28 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -8,4 +8,5 @@ Storage write permission is needed to save the image. Quitting: No source image selected + Saved as \'%1$s\' diff --git a/build.gradle b/build.gradle index 6b77fd2..e051d2c 100644 --- a/build.gradle +++ b/build.gradle @@ -7,14 +7,13 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } ext { - support = '28.0.0' - constraints = '1.0.2' + // constraints = '1.0.2' } } @@ -29,7 +28,6 @@ allprojects { ext { compileSdkVersion = 28 buildToolsVersion = '28.0.3' - supportLibraryVersion = '28.0.0' PUBLISH_GROUP_ID = 'net.realify.lib' PUBLISH_ARTIFACT_ID = 'android-image-cropper' diff --git a/cropper/build.gradle b/cropper/build.gradle index f3971aa..a1a5b4a 100644 --- a/cropper/build.gradle +++ b/cropper/build.gradle @@ -25,9 +25,9 @@ repositories { } dependencies { - api "com.android.support:support-v4:$supportLibraryVersion" - api "com.android.support:exifinterface:$supportLibraryVersion" - api "com.android.support:support-annotations:$support" + api 'androidx.legacy:legacy-support-v4:1.0.0' + api 'androidx.exifinterface:exifinterface:1.0.0' + api 'androidx.annotation:annotation:1.0.0' // implementation 'com.github.Realify:Android-Image-Cropper:master' } diff --git a/cropper/src/main/java/net/realify/lib/androidimagecropper/BitmapUtils.java b/cropper/src/main/java/net/realify/lib/androidimagecropper/BitmapUtils.java index 8edb53e..42c2109 100644 --- a/cropper/src/main/java/net/realify/lib/androidimagecropper/BitmapUtils.java +++ b/cropper/src/main/java/net/realify/lib/androidimagecropper/BitmapUtils.java @@ -21,7 +21,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.net.Uri; -import android.support.media.ExifInterface; +import androidx.exifinterface.media.ExifInterface; import android.util.Log; import android.util.Pair; diff --git a/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImage.java b/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImage.java index c266939..cf20b06 100644 --- a/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImage.java +++ b/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImage.java @@ -34,11 +34,11 @@ import android.os.Parcel; import android.os.Parcelable; import android.provider.MediaStore; -import android.support.annotation.DrawableRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; -import android.support.v4.app.Fragment; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; +import androidx.fragment.app.Fragment; import java.io.File; import java.io.InputStream; diff --git a/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageActivity.java b/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageActivity.java index 3d5d0fb..98eec3d 100644 --- a/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageActivity.java +++ b/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageActivity.java @@ -22,8 +22,8 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; // import android.support.v7.app.ActionBar; // import android.support.v7.app.AppCompatActivity; import android.util.Log; diff --git a/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageView.java b/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageView.java index ee5ac9a..27ec4c6 100644 --- a/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageView.java +++ b/cropper/src/main/java/net/realify/lib/androidimagecropper/CropImageView.java @@ -25,7 +25,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Parcelable; -import android.support.media.ExifInterface; +import androidx.exifinterface.media.ExifInterface; import android.util.AttributeSet; import android.util.Pair; import android.view.LayoutInflater; diff --git a/fastlane/metadata/android/en-US/changelogs/2.txt b/fastlane/metadata/android/en-US/changelogs/2.txt new file mode 100644 index 0000000..544c493 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/2.txt @@ -0,0 +1,4 @@ +Bugfix: missing read permission +Added: success message +ported to android-x + diff --git a/fastlane/metadata/android/en-US/images/featureGraphic.png b/fastlane/metadata/android/en-US/images/featureGraphic.png new file mode 100644 index 0000000..74ff782 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/featureGraphic.png differ diff --git a/gradle.properties b/gradle.properties index 82618ce..d546dea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,8 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e92a19d..75416e5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Apr 09 17:59:42 CEST 2019 +#Tue May 07 10:19:25 CEST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip