11package com.simplemobiletools.filemanager.pro.helpers
22
3- import android.annotation.SuppressLint
43import com.simplemobiletools.commons.activities.BaseSimpleActivity
54import com.simplemobiletools.commons.extensions.*
65import net.lingala.zip4j.io.outputstream.ZipOutputStream
@@ -13,13 +12,28 @@ import java.util.LinkedList
1312class CompressionHelper {
1413
1514 companion object {
16- @SuppressLint(" NewApi" )
1715 fun compressPaths (
1816 activity : BaseSimpleActivity ,
1917 sourcePaths : List <String >,
2018 targetPath : String ,
2119 compressionFormat : CompressionFormat ,
2220 password : String? = null
21+ ): Boolean {
22+ return when (compressionFormat) {
23+ CompressionFormat .ZIP -> compressToZip(activity, sourcePaths, targetPath, password)
24+ CompressionFormat .SEVEN_ZIP -> compressToSevenZip(activity, sourcePaths, targetPath, password)
25+ CompressionFormat .TAR_DEFLATE -> compressToTarDeflate(activity, sourcePaths, targetPath, password)
26+ CompressionFormat .TAR_GZ -> compressToTarGz(activity, sourcePaths, targetPath, password)
27+ CompressionFormat .TAR_SZ -> compressToTarSz(activity, sourcePaths, targetPath, password)
28+ CompressionFormat .TAR_XZ -> compressToTarXz(activity, sourcePaths, targetPath, password)
29+ }
30+ }
31+
32+ private fun compressToZip (
33+ activity : BaseSimpleActivity ,
34+ sourcePaths : List <String >,
35+ targetPath : String ,
36+ password : String? = null
2337 ): Boolean {
2438 val queue = LinkedList <String >()
2539 val fos = activity.getFileOutputStreamSync(targetPath, " application/zip" ) ? : return false
@@ -101,5 +115,50 @@ class CompressionHelper {
101115 }
102116 return true
103117 }
118+
119+ private fun compressToSevenZip (
120+ activity : BaseSimpleActivity ,
121+ sourcePaths : List <String >,
122+ targetPath : String ,
123+ password : String? = null
124+ ): Boolean {
125+ return false
126+ }
127+
128+ private fun compressToTarDeflate (
129+ activity : BaseSimpleActivity ,
130+ sourcePaths : List <String >,
131+ targetPath : String ,
132+ password : String? = null
133+ ): Boolean {
134+ return false
135+ }
136+
137+ private fun compressToTarGz (
138+ activity : BaseSimpleActivity ,
139+ sourcePaths : List <String >,
140+ targetPath : String ,
141+ password : String? = null
142+ ): Boolean {
143+ return false
144+ }
145+
146+ private fun compressToTarSz (
147+ activity : BaseSimpleActivity ,
148+ sourcePaths : List <String >,
149+ targetPath : String ,
150+ password : String? = null
151+ ): Boolean {
152+ return false
153+ }
154+
155+ private fun compressToTarXz (
156+ activity : BaseSimpleActivity ,
157+ sourcePaths : List <String >,
158+ targetPath : String ,
159+ password : String? = null
160+ ): Boolean {
161+ return false
162+ }
104163 }
105164}
0 commit comments