blob: 39c91dc951e0af2915bc179a362e4c73cbe7b780 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.libreoffice.storage.local;
import java.net.URI;
import org.libreoffice.storage.IDocumentProvider;
import org.libreoffice.storage.IFile;
import org.libreoffice.R;
import android.content.Context;
import android.os.Environment;
/**
* Implementation of IDocumentProvider for the local file system.
*/
public class LocalDocumentsProvider implements IDocumentProvider {
private int id;
public LocalDocumentsProvider(int id) {
this.id = id;
}
@Override
public IFile getRootDirectory(Context context) {
return new LocalFile(Environment.getExternalStorageDirectory());
}
@Override
public IFile createFromUri(Context context, URI uri) {
return new LocalFile(uri);
}
@Override
public int getNameResource() {
return R.string.local_file_system;
}
@Override
public int getId() {
return id;
}
@Override
public boolean checkProviderAvailability(Context context) {
return true;
}
}
|