Removed dependencies from java.nio package and decreased target android version from 29 to 13

This commit is contained in:
valfieri
2019-09-08 09:57:00 +02:00
parent 414d99525d
commit 09098893e6
4 changed files with 148 additions and 170 deletions

View File

@@ -8,4 +8,4 @@
# project structure.
# Project target.
target=android-10
target=android-13

View File

@@ -1,6 +1,6 @@
APP_PROJECT_PATH := $(call my-dir)/..
APP_CPPFLAGS += -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_ABI := armeabi armeabi-v7a
#APP_ABI := x86 # mainly for emulators
APP_STL := gnustl_static
APP_MODULES := libpng libjpeg main SDL

View File

@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-29
target=android-13

View File

@@ -16,9 +16,6 @@ import net.lingala.zip4j.model.enums.CompressionMethod;
import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
@@ -32,23 +29,6 @@ import org.libsdl.app.SDLActivity;
public class ImgDownloader {
private static String convertStreamToString(java.io.InputStream inputStream) {
final int bufferSize = 1024;
final char[] buffer = new char[bufferSize];
final StringBuilder out = new StringBuilder();
try {
Reader in = new InputStreamReader(inputStream, StandardCharsets.ISO_8859_1);
for (; ; ) {
int rsz = in.read(buffer, 0, buffer.length);
if (rsz < 0)
break;
out.append(buffer, 0, rsz);
}
} catch (Exception e) {
}
return out.toString();
}
private static String readLineByLineJava8(String filePath) {
StringBuilder contentBuilder = new StringBuilder();
@@ -393,7 +373,7 @@ public class ImgDownloader {
File[] listOfFile = resFolder.listFiles();
ZipFile zipFile = null;
InputStream stream = null;
java.nio.file.Path filePath = null;
File filePath = null;
try {
for (int i = 0; i < listOfFile.length; i++) {
if (listOfFile[i].getName().contains(".zip")) {
@@ -413,10 +393,9 @@ public class ImgDownloader {
if (setName.equalsIgnoreCase(names[1])) {
stream = zipFile.getInputStream(entry);
byte[] buffer = new byte[1];
java.nio.file.Path outDir = Paths.get(path + File.separator);
filePath = outDir.resolve("_cards.dat");
filePath = new File(path + File.separator + "_cards.dat");
try {
FileOutputStream fos = new FileOutputStream(filePath.toFile());
FileOutputStream fos = new FileOutputStream(filePath);
BufferedOutputStream bos = new BufferedOutputStream(fos, buffer.length);
int len;
while ((len = stream.read(buffer)) != -1) {
@@ -424,7 +403,7 @@ public class ImgDownloader {
}
fos.close();
bos.close();
cardsfilepath = filePath.toString();
cardsfilepath = filePath.getAbsolutePath();
todelete = true;
} catch (Exception ex) {
}
@@ -1304,7 +1283,7 @@ public class ImgDownloader {
Map<String, String> mappa = new HashMap<String, String>();
ZipFile zipFile = null;
InputStream stream = null;
java.nio.file.Path filePath = null;
File filePath = null;
try {
zipFile = new ZipFile(basePath + File.separator + listOfFiles[0].getName());
Enumeration<? extends ZipEntry> e = zipFile.entries();
@@ -1317,10 +1296,9 @@ public class ImgDownloader {
if (set.equalsIgnoreCase(names[1])) {
stream = zipFile.getInputStream(entry);
byte[] buffer = new byte[1];
java.nio.file.Path outDir = Paths.get(basePath);
filePath = outDir.resolve("_cards.dat");
filePath = new File(basePath + File.separator + "_cards.dat");
try {
FileOutputStream fos = new FileOutputStream(filePath.toFile());
FileOutputStream fos = new FileOutputStream(filePath);
BufferedOutputStream bos = new BufferedOutputStream(fos, buffer.length);
int len;
while ((len = stream.read(buffer)) != -1) {