Replace icafe with apache-commons-imaging

This commit is contained in:
Ammar Githam 2020-11-10 21:43:53 +09:00
parent d14f2a098c
commit 60e5007376
3 changed files with 7 additions and 7 deletions

View File

@ -80,8 +80,7 @@ dependencies {
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.github.dragon66:icafe:master-SNAPSHOT'
implementation 'javax.media:jai_imageio:1.1.1'
implementation 'org.apache.commons:commons-imaging:1.0-alpha2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'

View File

@ -26,8 +26,8 @@ import androidx.work.WorkerParameters;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.icafe4j.image.meta.Metadata;
import com.icafe4j.image.meta.MetadataType;
import org.apache.commons.imaging.formats.jpeg.iptc.JpegIptcRewriter;
import java.io.BufferedInputStream;
import java.io.File;
@ -89,6 +89,7 @@ public class DownloadWorker extends Worker {
try (Scanner scanner = new Scanner(requestFile)) {
downloadRequestString = scanner.useDelimiter("\\A").next();
} catch (Exception e) {
Log.e(TAG, "doWork: ", e);
return Result.failure(new Data.Builder()
.putString("error", e.getLocalizedMessage())
.build());
@ -170,9 +171,10 @@ public class DownloadWorker extends Worker {
}
if (isJpg) {
final File finalFile = new File(filePath);
try (FileInputStream bis = new FileInputStream(outFile);
try (FileInputStream fis = new FileInputStream(outFile);
FileOutputStream fos = new FileOutputStream(finalFile)) {
Metadata.removeMetadata(bis, fos, MetadataType.IPTC);
final JpegIptcRewriter jpegIptcRewriter = new JpegIptcRewriter();
jpegIptcRewriter.removeIPTC(fis, fos);
} catch (Exception e) {
Log.e(TAG, "Error while removing iptc: url: " + url
+ ", tempFile: " + outFile.getAbsolutePath()

View File

@ -16,7 +16,6 @@ allprojects {
google()
jcenter()
mavenCentral()
maven { url 'http://maven.geotoolkit.org/' }
maven { url 'https://jitpack.io' }
}
}