Search in sources :

Example 11 with RootFile

use of dev.dworks.apps.anexplorer.root.RootFile in project AnExplorer by 1hakr.

the class RootedStorageProvider method moveDocument.

@Override
public String moveDocument(String sourceDocumentId, String sourceParentDocumentId, String targetParentDocumentId) throws FileNotFoundException {
    final RootFile before = getRootFileForDocId(sourceDocumentId);
    final RootFile after = new RootFile(getRootFileForDocId(targetParentDocumentId).getPath(), before.getName());
    if (!RootCommands.renameRootTarget(before, after)) {
        throw new IllegalStateException("Failed to rename " + before);
    }
    final String afterDocId = getDocIdForRootFile(after);
    if (!TextUtils.equals(sourceDocumentId, afterDocId)) {
        notifyDocumentsChanged(afterDocId);
        return afterDocId;
    } else {
        return null;
    }
}
Also used : RootFile(dev.dworks.apps.anexplorer.root.RootFile)

Aggregations

RootFile (dev.dworks.apps.anexplorer.root.RootFile)11 FileNotFoundException (java.io.FileNotFoundException)5 IOException (java.io.IOException)4 Point (android.graphics.Point)2 MatrixCursor (dev.dworks.apps.anexplorer.cursor.MatrixCursor)2 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 Scanner (java.util.Scanner)2 InputStream (java.io.InputStream)1