Loading .idea/caches/build_file_checksums.ser (595 B) File changed.No diff preview for this file type. View original file View changed file .idea/modules.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,6 @@ <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/eDrive.iml" filepath="$PROJECT_DIR$/eDrive.iml" /> <module fileurl="file://$PROJECT_DIR$/eDrive.iml" filepath="$PROJECT_DIR$/eDrive.iml" /> <module fileurl="file://$PROJECT_DIR$/android-nc-lib/ncLib.iml" filepath="$PROJECT_DIR$/android-nc-lib/ncLib.iml" /> <module fileurl="file://$PROJECT_DIR$/android-nc-lib/ncLib.iml" filepath="$PROJECT_DIR$/android-nc-lib/ncLib.iml" /> <module fileurl="file://$PROJECT_DIR$/android-nc-lib/ncLib.iml" filepath="$PROJECT_DIR$/android-nc-lib/ncLib.iml" /> </modules> </modules> </component> </component> </project> </project> No newline at end of file android-nc-lib @ 643d25be Original line number Original line Diff line number Diff line Subproject commit d51fa00fcbb11abe7b87dc1e2fb514d5d15c51d2 Subproject commit 643d25be260f9bb0157a04b82e6e7a21d004d7c1 app/src/main/java/io/eelo/drive/operations/DownloadRemoteFileOperation.java +6 −14 Original line number Original line Diff line number Diff line //@TODO: Move this into Nextcloud android lib. By replaceing current DownloadRemoteFileOperation. /* ownCloud Android Library is available under MIT license /* ownCloud Android Library is available under MIT license * Copyright (C) 2015 ownCloud Inc. * Copyright (C) 2015 ownCloud Inc. * * Loading @@ -24,8 +26,9 @@ */ */ package io.eelo.drive.operations; package io.eelo.drive.operations; import android.util.Log; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.common.operations.OperationCancelledException; import com.owncloud.android.lib.common.operations.OperationCancelledException; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperation; Loading @@ -41,9 +44,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.IOException; import java.util.Date; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean; /** /** Loading @@ -58,7 +58,6 @@ import java.util.concurrent.atomic.AtomicBoolean; private static final String TAG = DownloadRemoteFileOperation.class.getSimpleName(); private static final String TAG = DownloadRemoteFileOperation.class.getSimpleName(); private final Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>(); private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false); private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false); private long mModificationTimestamp = 0; private long mModificationTimestamp = 0; private String mEtag = ""; private String mEtag = ""; Loading Loading @@ -105,8 +104,7 @@ import java.util.concurrent.atomic.AtomicBoolean; int status = -1; int status = -1; boolean savedFile = false; boolean savedFile = false; mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath)); mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath)); Iterator<OnDatatransferProgressListener> dataTransferListenerIterator = null; Log.d("DownloadRemoteFileOp","query string:"+mGet.getQueryString()); FileOutputStream fos = null; FileOutputStream fos = null; try { try { status = client.executeMethod(mGet); status = client.executeMethod(mGet); Loading @@ -132,13 +130,7 @@ import java.util.concurrent.atomic.AtomicBoolean; } } fos.write(bytes, 0, readResult); fos.write(bytes, 0, readResult); transferred += readResult; transferred += readResult; synchronized (mDataTransferListeners) { dataTransferListenerIterator = mDataTransferListeners.iterator(); while (dataTransferListenerIterator.hasNext()) { dataTransferListenerIterator.next().onTransferProgress(readResult, transferred, totalToTransfer, targetFile.getName()); } } } } // Check if the file is completed // Check if the file is completed // if transfer-encoding: chunked we cannot check if the file is complete // if transfer-encoding: chunked we cannot check if the file is complete Loading app/src/main/java/io/eelo/drive/operations/ListRemoteFileOperation.java +9 −8 Original line number Original line Diff line number Diff line Loading @@ -80,21 +80,22 @@ public class ListRemoteFileOperation extends RemoteOperation { RemoteOperationResult result = operation.execute(ownCloudClient); RemoteOperationResult result = operation.execute(ownCloudClient); if(result.isSuccess() ){ if(result.isSuccess() ){ //is success then data can't be null //is success thus data can't be null int dataSize = result.getData().size(); if(dataSize > 1){ //There is at least one subfiles ArrayList<Object> datas = result.getData(); RemoteFile directory = (RemoteFile) result.getData().get(0); int dataSize = datas.size(); if(dataSize > 1){ //There is at least one subfiles. Note: data[0] contains the folder. RemoteFile directory = (RemoteFile) datas.get(0); if(!directory.getEtag().equals(syncedFolder.getLastEtag() )){ //if etag differs if(!directory.getEtag().equals(syncedFolder.getLastEtag() )){ //if etag differs List<Object> remoteFiles = result.getData().subList( 1, dataSize ); //get list of subfiles //loop through subelements //loop through subelements for (int i = -1, remoteFilesSize = remoteFiles.size(); ++i < remoteFilesSize; ){ for (int i = 0; ++i < dataSize; ){ RemoteFile remoteFile = (RemoteFile) remoteFiles.get(i); RemoteFile remoteFile = (RemoteFile) datas.get(i); if( remoteFile.getMimeType().equals("DIR") ) { if( remoteFile.getMimeType().equals("DIR") ) { String suffixPath = remoteFile.getRemotePath().substring( syncedFolder.getRemoteFolder().length() ); String suffixPath = remoteFile.getRemotePath().substring( syncedFolder.getRemoteFolder().length() ); //but is it already known as SyncedFolder? SyncedFolder subSyncedFolder = new SyncedFolder(syncedFolder, suffixPath, 0L, "" ); //need to set empty etag to allow it to be scan SyncedFolder subSyncedFolder = new SyncedFolder(syncedFolder, suffixPath, 0L, "" ); //need to set empty etag to allow it to be scan mSyncedFolderIterator.add(subSyncedFolder); mSyncedFolderIterator.add(subSyncedFolder); mSyncedFolderIterator.previous(); mSyncedFolderIterator.previous(); Loading Loading
.idea/caches/build_file_checksums.ser (595 B) File changed.No diff preview for this file type. View original file View changed file
.idea/modules.xml +0 −1 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,6 @@ <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/eDrive.iml" filepath="$PROJECT_DIR$/eDrive.iml" /> <module fileurl="file://$PROJECT_DIR$/eDrive.iml" filepath="$PROJECT_DIR$/eDrive.iml" /> <module fileurl="file://$PROJECT_DIR$/android-nc-lib/ncLib.iml" filepath="$PROJECT_DIR$/android-nc-lib/ncLib.iml" /> <module fileurl="file://$PROJECT_DIR$/android-nc-lib/ncLib.iml" filepath="$PROJECT_DIR$/android-nc-lib/ncLib.iml" /> <module fileurl="file://$PROJECT_DIR$/android-nc-lib/ncLib.iml" filepath="$PROJECT_DIR$/android-nc-lib/ncLib.iml" /> </modules> </modules> </component> </component> </project> </project> No newline at end of file
android-nc-lib @ 643d25be Original line number Original line Diff line number Diff line Subproject commit d51fa00fcbb11abe7b87dc1e2fb514d5d15c51d2 Subproject commit 643d25be260f9bb0157a04b82e6e7a21d004d7c1
app/src/main/java/io/eelo/drive/operations/DownloadRemoteFileOperation.java +6 −14 Original line number Original line Diff line number Diff line //@TODO: Move this into Nextcloud android lib. By replaceing current DownloadRemoteFileOperation. /* ownCloud Android Library is available under MIT license /* ownCloud Android Library is available under MIT license * Copyright (C) 2015 ownCloud Inc. * Copyright (C) 2015 ownCloud Inc. * * Loading @@ -24,8 +26,9 @@ */ */ package io.eelo.drive.operations; package io.eelo.drive.operations; import android.util.Log; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.network.OnDatatransferProgressListener; import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.common.network.WebdavUtils; import com.owncloud.android.lib.common.operations.OperationCancelledException; import com.owncloud.android.lib.common.operations.OperationCancelledException; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperation; Loading @@ -41,9 +44,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.IOException; import java.util.Date; import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean; /** /** Loading @@ -58,7 +58,6 @@ import java.util.concurrent.atomic.AtomicBoolean; private static final String TAG = DownloadRemoteFileOperation.class.getSimpleName(); private static final String TAG = DownloadRemoteFileOperation.class.getSimpleName(); private final Set<OnDatatransferProgressListener> mDataTransferListeners = new HashSet<OnDatatransferProgressListener>(); private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false); private final AtomicBoolean mCancellationRequested = new AtomicBoolean(false); private long mModificationTimestamp = 0; private long mModificationTimestamp = 0; private String mEtag = ""; private String mEtag = ""; Loading Loading @@ -105,8 +104,7 @@ import java.util.concurrent.atomic.AtomicBoolean; int status = -1; int status = -1; boolean savedFile = false; boolean savedFile = false; mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath)); mGet = new GetMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath)); Iterator<OnDatatransferProgressListener> dataTransferListenerIterator = null; Log.d("DownloadRemoteFileOp","query string:"+mGet.getQueryString()); FileOutputStream fos = null; FileOutputStream fos = null; try { try { status = client.executeMethod(mGet); status = client.executeMethod(mGet); Loading @@ -132,13 +130,7 @@ import java.util.concurrent.atomic.AtomicBoolean; } } fos.write(bytes, 0, readResult); fos.write(bytes, 0, readResult); transferred += readResult; transferred += readResult; synchronized (mDataTransferListeners) { dataTransferListenerIterator = mDataTransferListeners.iterator(); while (dataTransferListenerIterator.hasNext()) { dataTransferListenerIterator.next().onTransferProgress(readResult, transferred, totalToTransfer, targetFile.getName()); } } } } // Check if the file is completed // Check if the file is completed // if transfer-encoding: chunked we cannot check if the file is complete // if transfer-encoding: chunked we cannot check if the file is complete Loading
app/src/main/java/io/eelo/drive/operations/ListRemoteFileOperation.java +9 −8 Original line number Original line Diff line number Diff line Loading @@ -80,21 +80,22 @@ public class ListRemoteFileOperation extends RemoteOperation { RemoteOperationResult result = operation.execute(ownCloudClient); RemoteOperationResult result = operation.execute(ownCloudClient); if(result.isSuccess() ){ if(result.isSuccess() ){ //is success then data can't be null //is success thus data can't be null int dataSize = result.getData().size(); if(dataSize > 1){ //There is at least one subfiles ArrayList<Object> datas = result.getData(); RemoteFile directory = (RemoteFile) result.getData().get(0); int dataSize = datas.size(); if(dataSize > 1){ //There is at least one subfiles. Note: data[0] contains the folder. RemoteFile directory = (RemoteFile) datas.get(0); if(!directory.getEtag().equals(syncedFolder.getLastEtag() )){ //if etag differs if(!directory.getEtag().equals(syncedFolder.getLastEtag() )){ //if etag differs List<Object> remoteFiles = result.getData().subList( 1, dataSize ); //get list of subfiles //loop through subelements //loop through subelements for (int i = -1, remoteFilesSize = remoteFiles.size(); ++i < remoteFilesSize; ){ for (int i = 0; ++i < dataSize; ){ RemoteFile remoteFile = (RemoteFile) remoteFiles.get(i); RemoteFile remoteFile = (RemoteFile) datas.get(i); if( remoteFile.getMimeType().equals("DIR") ) { if( remoteFile.getMimeType().equals("DIR") ) { String suffixPath = remoteFile.getRemotePath().substring( syncedFolder.getRemoteFolder().length() ); String suffixPath = remoteFile.getRemotePath().substring( syncedFolder.getRemoteFolder().length() ); //but is it already known as SyncedFolder? SyncedFolder subSyncedFolder = new SyncedFolder(syncedFolder, suffixPath, 0L, "" ); //need to set empty etag to allow it to be scan SyncedFolder subSyncedFolder = new SyncedFolder(syncedFolder, suffixPath, 0L, "" ); //need to set empty etag to allow it to be scan mSyncedFolderIterator.add(subSyncedFolder); mSyncedFolderIterator.add(subSyncedFolder); mSyncedFolderIterator.previous(); mSyncedFolderIterator.previous(); Loading