From 92d7ffce82ddfa878e1ea2dfbbb7ed2acc321461 Mon Sep 17 00:00:00 2001 From: linsui Date: Wed, 20 Jul 2022 19:59:59 +0800 Subject: [PATCH] fdroid: remove rar support --- app/build.gradle | 2 +- .../extractcontents/helpers/RarExtractor.kt | 35 ++++++++++++++++++ .../showcontents/helpers/RarDecompressor.kt | 37 +++++++++++++++++++ .../exception/UnsupportedRarV5Exception.java | 29 +++++++++++++++ .../compressed/CompressedHelper.java | 4 +- .../asynctasks/compress/RarHelperCallable.kt | 0 .../filesystem/compressed/Extensions.kt | 0 .../extractcontents/helpers/RarExtractor.kt | 0 .../showcontents/helpers/RarDecompressor.kt | 0 file_operations/build.gradle | 2 - 10 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt create mode 100644 app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt create mode 100644 app/src/fdroid/java/com/github/junrar/exception/UnsupportedRarV5Exception.java rename app/src/{main => play}/java/com/amaze/filemanager/asynchronous/asynctasks/compress/RarHelperCallable.kt (100%) rename app/src/{main => play}/java/com/amaze/filemanager/filesystem/compressed/Extensions.kt (100%) rename app/src/{main => play}/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt (100%) rename app/src/{main => play}/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt (100%) diff --git a/app/build.gradle b/app/build.gradle index e491e70d7..63cb7cd9a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -166,7 +166,7 @@ dependencies { implementation "org.apache.commons:commons-compress:$commonsCompressVersion" - implementation "com.github.junrar:junrar:$junrarVersion" + playImplementation "com.github.junrar:junrar:$junrarVersion" implementation "com.afollestad.material-dialogs:core:$materialDialogsVersion" implementation "com.afollestad.material-dialogs:commons:$materialDialogsVersion" diff --git a/app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt b/app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt new file mode 100644 index 000000000..359920634 --- /dev/null +++ b/app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2014-2021 Arpit Khurana , Vishal Nehra , + * Emmanuel Messulam, Raymond Lai and Contributors. + * + * This file is part of Amaze File Manager. + * + * Amaze File Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.amaze.filemanager.filesystem.compressed.extractcontents.helpers + +import android.content.Context +import com.amaze.filemanager.fileoperations.utils.UpdatePosition +import com.amaze.filemanager.filesystem.compressed.extractcontents.Extractor + +class RarExtractor( + context: Context, + filePath: String, + outputPath: String, + listener: OnUpdate, + updatePosition: UpdatePosition +) : Extractor(context, filePath, outputPath, listener, updatePosition) { + override fun extractWithFilter(filter: Filter) {} +} diff --git a/app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt b/app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt new file mode 100644 index 000000000..aceb23e1e --- /dev/null +++ b/app/src/fdroid/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014-2021 Arpit Khurana , Vishal Nehra , + * Emmanuel Messulam, Raymond Lai and Contributors. + * + * This file is part of Amaze File Manager. + * + * Amaze File Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.amaze.filemanager.filesystem.compressed.showcontents.helpers + +import android.content.Context +import com.amaze.filemanager.asynchronous.asynctasks.compress.UnknownCompressedFileHelperCallable +import com.amaze.filemanager.filesystem.compressed.showcontents.Decompressor + +class RarDecompressor(context: Context) : Decompressor(context) { + override fun changePath( + path: String, + addGoBackItem: Boolean + ) = + UnknownCompressedFileHelperCallable(filePath, addGoBackItem) + + override fun realRelativeDirectory(dir: String): String { + return "" + } +} diff --git a/app/src/fdroid/java/com/github/junrar/exception/UnsupportedRarV5Exception.java b/app/src/fdroid/java/com/github/junrar/exception/UnsupportedRarV5Exception.java new file mode 100644 index 000000000..614c7e8a8 --- /dev/null +++ b/app/src/fdroid/java/com/github/junrar/exception/UnsupportedRarV5Exception.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2014-2022 Arpit Khurana , Vishal Nehra , + * Emmanuel Messulam, Raymond Lai and Contributors. + * + * This file is part of Amaze File Manager. + * + * Amaze File Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.github.junrar.exception; + +public class UnsupportedRarV5Exception extends Exception { + public UnsupportedRarV5Exception(Throwable cause) { + super(cause); + } + + public UnsupportedRarV5Exception() {} +} diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/compressed/CompressedHelper.java b/app/src/main/java/com/amaze/filemanager/filesystem/compressed/CompressedHelper.java index aab2a2b72..8dc2a80cf 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/compressed/CompressedHelper.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/compressed/CompressedHelper.java @@ -100,7 +100,7 @@ public abstract class CompressedHelper { if (isZip(type)) { extractor = new ZipExtractor(context, file.getPath(), outputPath, listener, updatePosition); - } else if (isRar(type)) { + } else if (BuildConfig.FLAVOR.equals("play") && isRar(type)) { extractor = new RarExtractor(context, file.getPath(), outputPath, listener, updatePosition); } else if (isTar(type)) { extractor = new TarExtractor(context, file.getPath(), outputPath, listener, updatePosition); @@ -144,7 +144,7 @@ public abstract class CompressedHelper { if (isZip(type)) { decompressor = new ZipDecompressor(context); - } else if (isRar(type)) { + } else if (BuildConfig.FLAVOR.equals("play") && isRar(type)) { decompressor = new RarDecompressor(context); } else if (isTar(type)) { decompressor = new TarDecompressor(context); diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/RarHelperCallable.kt b/app/src/play/java/com/amaze/filemanager/asynchronous/asynctasks/compress/RarHelperCallable.kt similarity index 100% rename from app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/RarHelperCallable.kt rename to app/src/play/java/com/amaze/filemanager/asynchronous/asynctasks/compress/RarHelperCallable.kt diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/compressed/Extensions.kt b/app/src/play/java/com/amaze/filemanager/filesystem/compressed/Extensions.kt similarity index 100% rename from app/src/main/java/com/amaze/filemanager/filesystem/compressed/Extensions.kt rename to app/src/play/java/com/amaze/filemanager/filesystem/compressed/Extensions.kt diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt b/app/src/play/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt similarity index 100% rename from app/src/main/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt rename to app/src/play/java/com/amaze/filemanager/filesystem/compressed/extractcontents/helpers/RarExtractor.kt diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt b/app/src/play/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt similarity index 100% rename from app/src/main/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt rename to app/src/play/java/com/amaze/filemanager/filesystem/compressed/showcontents/helpers/RarDecompressor.kt diff --git a/file_operations/build.gradle b/file_operations/build.gradle index 17b521e34..4cff08633 100644 --- a/file_operations/build.gradle +++ b/file_operations/build.gradle @@ -63,8 +63,6 @@ dependencies { implementation "org.apache.commons:commons-compress:$commonsCompressVersion" - implementation "com.github.junrar:junrar:$junrarVersion" - //zip4j: support password-protected zips implementation "net.lingala.zip4j:zip4j:$zip4jVersion"