fix lint warnings

Signed-off-by: Jens Mueller <tschenser@gmx.de>
This commit is contained in:
Jens Mueller 2019-05-15 17:10:38 +02:00 committed by Andy Scherzinger
parent dddffce2a1
commit fbff63bb02
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 13 additions and 9 deletions

View file

@ -179,7 +179,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
boolean isLoading = false; boolean isLoading = false;
if (parentFolder.isExpired()) { if (parentFolder.isExpired()) {
final LoadChildrenTask task = new LoadChildrenTask(parentFolder, getContext(), loadChildrenCallback); final LoadChildrenTask task = new LoadChildrenTask(parentFolder, loadChildrenCallback);
task.executeOnExecutor(executor); task.executeOnExecutor(executor);
resultCursor.setLoadingTask(task); resultCursor.setLoadingTask(task);
isLoading = true; isLoading = true;
@ -735,12 +735,10 @@ public class DocumentsStorageProvider extends DocumentsProvider {
static class LoadChildrenTask extends AsyncTask<Void, Void, RemoteOperationResult> { static class LoadChildrenTask extends AsyncTask<Void, Void, RemoteOperationResult> {
private final Document document; private final Document document;
private final Context context;
private final OnTaskFinishedCallback<Document> callback; private final OnTaskFinishedCallback<Document> callback;
LoadChildrenTask(Document document, Context context, OnTaskFinishedCallback<Document> callback) { LoadChildrenTask(Document document, OnTaskFinishedCallback<Document> callback) {
this.document = document; this.document = document;
this.context = context;
this.callback = callback; this.callback = callback;
} }
@ -749,7 +747,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
Log.d(TAG, "run RefreshDocumentTask(), id=" + document.getDocumentId()); Log.d(TAG, "run RefreshDocumentTask(), id=" + document.getDocumentId());
return new RefreshFolderOperation(document.getFile(), System.currentTimeMillis(), false, return new RefreshFolderOperation(document.getFile(), System.currentTimeMillis(), false,
false, true, document.getStorageManager(), document.getAccount(), false, true, document.getStorageManager(), document.getAccount(),
context).execute(document.getClient()); MainApp.getAppContext()).execute(document.getClient());
} }
@Override @Override
@ -768,9 +766,9 @@ public class DocumentsStorageProvider extends DocumentsProvider {
public class Document { public class Document {
private final FileDataStorageManager storageManager; private final FileDataStorageManager storageManager;
private final Long fileId; private final long fileId;
Document(FileDataStorageManager storageManager, Long fileId) { Document(FileDataStorageManager storageManager, long fileId) {
this.storageManager = storageManager; this.storageManager = storageManager;
this.fileId = fileId; this.fileId = fileId;
} }

View file

@ -25,6 +25,7 @@ import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.database.MatrixCursor; import android.database.MatrixCursor;
import android.os.Build; import android.os.Build;
import android.provider.DocumentsContract;
import android.provider.DocumentsContract.Root; import android.provider.DocumentsContract.Root;
import com.owncloud.android.R; import com.owncloud.android.R;
@ -50,12 +51,17 @@ public class RootCursor extends MatrixCursor {
public void addRoot(DocumentsStorageProvider.Document document, Context context) { public void addRoot(DocumentsStorageProvider.Document document, Context context) {
Account account = document.getAccount(); Account account = document.getAccount();
int rootFlags = Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_RECENTS | Root.FLAG_SUPPORTS_SEARCH;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
rootFlags = rootFlags | Root.FLAG_SUPPORTS_IS_CHILD;
}
newRow().add(Root.COLUMN_ROOT_ID, account.name) newRow().add(Root.COLUMN_ROOT_ID, account.name)
.add(Root.COLUMN_DOCUMENT_ID, document.getDocumentId()) .add(Root.COLUMN_DOCUMENT_ID, document.getDocumentId())
.add(Root.COLUMN_SUMMARY, account.name) .add(Root.COLUMN_SUMMARY, account.name)
.add(Root.COLUMN_TITLE, context.getString(R.string.app_name)) .add(Root.COLUMN_TITLE, context.getString(R.string.app_name))
.add(Root.COLUMN_ICON, R.mipmap.ic_launcher) .add(Root.COLUMN_ICON, R.mipmap.ic_launcher)
.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_IS_CHILD | .add(Root.COLUMN_FLAGS, rootFlags);
Root.FLAG_SUPPORTS_RECENTS | Root.FLAG_SUPPORTS_SEARCH);
} }
} }