mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Add counting magic
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
6496d7267a
commit
e40086d2ab
1 changed files with 21 additions and 0 deletions
|
@ -40,6 +40,27 @@ public class FilesystemDataProvider {
|
|||
this.contentResolver = contentResolver;
|
||||
}
|
||||
|
||||
public long countFilesThatNeedUploadInFolder(String localPath) {
|
||||
String likeParam = localPath + "%";
|
||||
|
||||
Cursor cursor = contentResolver.query(
|
||||
ProviderMeta.ProviderTableMeta.CONTENT_URI_FILESYSTEM,
|
||||
new String[] {"count(*)"},
|
||||
ProviderMeta.ProviderTableMeta.FILESYSTEM_FILE_LOCAL_PATH + " LIKE ?",
|
||||
new String[]{likeParam},
|
||||
null);
|
||||
|
||||
if (cursor.getCount() == 0) {
|
||||
cursor.close();
|
||||
return 0;
|
||||
} else {
|
||||
cursor.moveToFirst();
|
||||
int result = cursor.getInt(0);
|
||||
cursor.close();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public void storeOrUpdateFileValue(String localPath, long modifiedAt, boolean isFolder, boolean sentForUpload) {
|
||||
FileSystemDataSet data = getFilesystemDataSet(localPath);
|
||||
|
||||
|
|
Loading…
Reference in a new issue