From fe9c9ecc5c124221beadfa52d5fba29aeb348e42 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Tue, 12 Feb 2019 17:53:01 +0200 Subject: [PATCH] work in progress --- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 10 +++++++++- OsmAnd/src/net/osmand/aidl/tiles/CopyFileParams.java | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index c3f273e4c9..3eefaf4973 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -2006,7 +2006,15 @@ public class OsmandAidlApi { fos = new FileOutputStream(file, true); fos.write(fileParams.getFilePartData()); copyFilesCache.put( - key, new FileCopyInfo(fileParams.getStartTime(), System.currentTimeMillis(), fos)); + key, new FileCopyInfo(fileParams.getStartTime(), System.currentTimeMillis(), + fos)); + return COPY_FILE_OK_RESPONSE; + } else if (fileParams.getActionId() == COPY_FILE_FINISH_FLAG) { + file.delete(); + file.getParentFile().mkdirs(); + fos = new FileOutputStream(file, true); + fos.write(fileParams.getFilePartData()); + file.renameTo(app.getAppPath(destination + fileParams.getFilename())); return COPY_FILE_OK_RESPONSE; } else { return COPY_FILE_PARAMS_ERROR; diff --git a/OsmAnd/src/net/osmand/aidl/tiles/CopyFileParams.java b/OsmAnd/src/net/osmand/aidl/tiles/CopyFileParams.java index 4bb12274e1..161ee7ad77 100644 --- a/OsmAnd/src/net/osmand/aidl/tiles/CopyFileParams.java +++ b/OsmAnd/src/net/osmand/aidl/tiles/CopyFileParams.java @@ -2,6 +2,7 @@ package net.osmand.aidl.tiles; import android.os.Parcel; import android.os.Parcelable; +import java.util.Arrays; public class CopyFileParams implements Parcelable { private String filename; @@ -58,6 +59,16 @@ public class CopyFileParams implements Parcelable { return 0; } + @Override + public String toString() { + return "CopyFileParams{" + + "filename='" + filename + '\'' + + ", filePartData=" + filePartData + + ", startTime=" + startTime + + ", actionId=" + actionId + + '}'; + } + @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(filename);