Search in sources :

Example 11 with DocumentFile

use of com.genonbeta.TrebleShot.io.DocumentFile in project TrebleShot by genonbeta.

the class TransactionGroupInfoDialog method calculateSpace.

public boolean calculateSpace() {
    DocumentFile documentFile = FileUtils.getSavePath(getContext(), mGroup);
    long freeSpace = documentFile instanceof LocalDocumentFile ? ((LocalDocumentFile) documentFile).getFile().getFreeSpace() : -1;
    mDatabase.calculateTransactionSize(mGroup.groupId, getIndex());
    return freeSpace == -1 || freeSpace >= getIndex().incoming;
}
Also used : LocalDocumentFile(com.genonbeta.TrebleShot.io.LocalDocumentFile) DocumentFile(com.genonbeta.TrebleShot.io.DocumentFile) LocalDocumentFile(com.genonbeta.TrebleShot.io.LocalDocumentFile)

Aggregations

DocumentFile (com.genonbeta.TrebleShot.io.DocumentFile)11 IOException (java.io.IOException)5 LocalDocumentFile (com.genonbeta.TrebleShot.io.LocalDocumentFile)4 FileNotFoundException (java.io.FileNotFoundException)4 File (java.io.File)3 View (android.view.View)2 StreamDocumentFile (com.genonbeta.TrebleShot.io.StreamDocumentFile)2 TreeDocumentFile (com.genonbeta.TrebleShot.io.TreeDocumentFile)2 SuppressLint (android.annotation.SuppressLint)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 Resources (android.content.res.Resources)1 Uri (android.net.Uri)1 Handler (android.os.Handler)1 Nullable (android.support.annotation.Nullable)1 AlertDialog (android.support.v7.app.AlertDialog)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1