Skip to content

Commit

Permalink
Lib versions update, fixing #4
Browse files Browse the repository at this point in the history
  • Loading branch information
k3b committed Jul 6, 2020
1 parent 4d4def7 commit cb33a36
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 30 deletions.
22 changes: 15 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ android {
// 1.1.1.190522 (5) Errorhandling/display errormessage; delete temp files; action com.android.camera.action.CROP
// 1.1.2.190605 (6) bugfixes send/get_content; translation-updates "en", "de","nb-rNO"
// 1.2.0.191107 (7) Added jpg Image Rotation
versionCode 7
versionName "1.2.0.191107"
// 1.2.1.200708 (8) fix #4: Cropping result image without exif-thumbnail
versionCode 8
versionName "1.2.1.200708"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// all supported locales. Note: the lib has more translations which are supressed here
Expand All @@ -37,23 +38,30 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
// http://stackoverflow.com/questions/31350350/generating-signed-apk-error7-missingtranslation-in-build-generated-res-gen
// MissingTranslation : not all crowdwin translations are complete so ignore them
disable 'MissingTranslation'

abortOnError false
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.annotation:annotation:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


// implements lossless croppig
// implementation 'com.facebook.spectrum:spectrum-default:1.0.0'
implementation 'com.facebook.spectrum:spectrum-core:1.0.0'
implementation 'com.facebook.spectrum:spectrum-jpeg:1.0.0'
implementation 'com.facebook.spectrum:spectrum-core:1.2.0'
implementation 'com.facebook.spectrum:spectrum-jpeg:1.2.0'
// the cropping gui
// implementation 'com.edmodo:cropper:1.0.1'
// implementation "com.naver.android.helloyako:imagecropview:1.2.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider;
import androidx.exifinterface.media.ExifInterface;

import android.provider.DocumentsContract;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider;
import androidx.exifinterface.media.ExifInterface;

import net.realify.lib.androidimagecropper.CropImageView;

import java.io.Closeable;
Expand All @@ -30,30 +30,31 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

import de.k3b.util.TempFileUtil;

/** For all different workflows CropAreaXxxxActivity:
/**
* For all different workflows CropAreaXxxxActivity:
* * Displays the cropping gui
* * Contains Protected helpers for common functionalities */
abstract class CropAreasChooseBaseActivity extends BaseActivity {
* * Contains Protected helpers for common functionalities
*/
abstract class CropAreasChooseBaseActivity extends BaseActivity {
protected static final String TAG = "LLCrop";
protected static final boolean LOAD_ASYNC = false;

private static int lastInstanceNo4Debug = 0;
private int instanceNo4Debug = 0;

private final int idMenuMainMethod;
private final Map<Integer,Integer> menu2Rotation;
private final Map<Integer, Integer> menu2Rotation;

protected CropAreasChooseBaseActivity(int idMenuMainMethod) {
this.idMenuMainMethod = idMenuMainMethod;
menu2Rotation = new HashMap<Integer,Integer>();
menu2Rotation = new HashMap<>();
menu2Rotation.put(R.id.menu_rotate_0, 0);
menu2Rotation.put(R.id.menu_rotate_90, 90);
menu2Rotation.put(R.id.menu_rotate_180, 180);
Expand Down Expand Up @@ -145,7 +146,6 @@ protected void onGetEditPictureResult(int resultCode, Intent data) {
Log.d(TAG, getInstanceNo4Debug() + getString(R.string.toast_cannot_retrieve_selected_image));
Toast.makeText(getBaseContext(), R.string.toast_cannot_retrieve_selected_image, Toast.LENGTH_SHORT).show();
finishIfMainMethod(R.id.menu_save);
return;
}
protected void onSaveEditPictureAsOutputUriPickerResult(Uri _outUri) {

Expand Down Expand Up @@ -314,7 +314,9 @@ protected void SetImageUriAndLastCropArea(Uri uri, Rect crop) {
Bitmap bitmap = BitmapFactory.decodeStream(stream);
ExifInterface exif = getExif(this, uri);
uCropView.setImageBitmap(bitmap, exif);
setBaseRotation(exif.getRotationDegrees());
if (exif != null) {
setBaseRotation(exif.getRotationDegrees());
}
}
setCropRect(crop);

Expand Down Expand Up @@ -354,8 +356,7 @@ private static void saveClose(Closeable is) {
protected Uri getSourceImageUri(Intent intent) {
if (intent == null) return null;

Uri uri = intent.getData();
return uri;
return intent.getData();
}

private void setCropRect(final Rect crop) {
Expand Down Expand Up @@ -467,6 +468,13 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
edit.saveAsPublicCroppedImage();
return;
}
} else {
Log.i(TAG, this.getClass().getSimpleName()
+ ": " + getText(R.string.permission_error));
Toast.makeText(this, R.string.permission_error, Toast.LENGTH_LONG).show();
setResult(Activity.RESULT_CANCELED, null);
finish();

}
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Expand Down Expand Up @@ -600,7 +608,9 @@ public boolean onCreateOptionsMenu(final Menu menu) {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
for(Integer key : menu2Rotation.keySet()) {
menu.findItem(key.intValue()).setChecked(getRotation() == menu2Rotation.get(key).intValue());
if (key != null) {
menu.findItem(key).setChecked(getRotation() == menu2Rotation.get(key));
}
}
return super.onPrepareOptionsMenu(menu);
}
Expand All @@ -610,7 +620,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
Integer rotation = menu2Rotation.get(item.getItemId());
if (rotation != null) {
this.setRotation(rotation.intValue());
this.setRotation(rotation);
uCropView.setRotatedDegrees(this.getRotation());
return true;
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ this program. If not, see <http://www.gnu.org/licenses/>
<string name="toast_saved_as">Gespeichert als \'%1$s\'</string>
<string name="toast_saved_error">Kann nicht speichern unter \'%1$s\'.\n\n%2$s</string>
<string name="label_rotate">Drehen ...</string>
<string name="permission_error">Keine Berechtigungen</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ this program. If not, see <http://www.gnu.org/licenses/>
<string name="toast_saved_as">Saved as \'%1$s\'</string>
<string name="toast_saved_error">Cannot save as \'%1$s\'.\n\n%2$s</string>
<string name="label_rotate">Rotate ...</string>
<string name="permission_error">Missing permisions</string>
</resources>
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:4.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -27,7 +27,6 @@ allprojects {

ext {
compileSdkVersion = 28
buildToolsVersion = '28.0.3'

PUBLISH_GROUP_ID = 'net.realify.lib'
PUBLISH_ARTIFACT_ID = 'android-image-cropper'
Expand Down
5 changes: 2 additions & 3 deletions cropper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apply plugin: 'com.android.library'
android {

compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion

defaultConfig {
minSdkVersion 15
Expand All @@ -26,8 +25,8 @@ repositories {

dependencies {
api 'androidx.legacy:legacy-support-v4:1.0.0'
api 'androidx.exifinterface:exifinterface:1.0.0'
api 'androidx.annotation:annotation:1.0.0'
api 'androidx.exifinterface:exifinterface:1.2.0'
api 'androidx.annotation:annotation:1.1.0'

// implementation 'com.github.Realify:Android-Image-Cropper:master'
}
Expand Down
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
# distributionSha256Sum from https://services.gradle.org/distributions/gradle-6.1.1-all.zip.sha256
distributionSha256Sum=10065868c78f1207afb3a92176f99a37d753a513dff453abb6b5cceda4058cda

0 comments on commit cb33a36

Please sign in to comment.