Search in sources :

Example 1 with RootCursor

use of org.nextcloud.providers.cursors.RootCursor in project android by nextcloud.

the class DocumentsStorageProvider method queryRoots.

@Override
public Cursor queryRoots(String[] projection) {
    // always recreate storage manager collection, as it will change after account creation/removal
    // and we need to serve document(tree)s with persist permissions
    initiateStorageMap();
    Context context = MainApp.getAppContext();
    AppPreferences preferences = AppPreferencesImpl.fromContext(context);
    if (SettingsActivity.LOCK_PASSCODE.equals(preferences.getLockPreference()) || SettingsActivity.LOCK_DEVICE_CREDENTIALS.equals(preferences.getLockPreference())) {
        return new FileCursor();
    }
    final RootCursor result = new RootCursor(projection);
    for (int i = 0; i < rootIdToStorageManager.size(); i++) {
        result.addRoot(new Document(rootIdToStorageManager.valueAt(i), ROOT_PATH), getContext());
    }
    return result;
}
Also used : Context(android.content.Context) FileCursor(org.nextcloud.providers.cursors.FileCursor) AppPreferences(com.nextcloud.client.preferences.AppPreferences) RootCursor(org.nextcloud.providers.cursors.RootCursor) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 Point (android.graphics.Point)1 AppPreferences (com.nextcloud.client.preferences.AppPreferences)1 FileCursor (org.nextcloud.providers.cursors.FileCursor)1 RootCursor (org.nextcloud.providers.cursors.RootCursor)1