Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added code to store temporary uri permissions and also consult them w…
…hen deciding whether we can write to a given uri or not
- Loading branch information
Christian Gogolin
committed
Jan 13, 2016
1 parent
eece517
commit 1ee94f8
Showing
7 changed files
with
199 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
platform/android/src/com/cgogolin/penandpdf/MyContentProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.cgogolin.penandpdf; | ||
|
||
import android.database.Cursor; | ||
import android.database.MatrixCursor; | ||
import android.os.CancellationSignal; | ||
import android.os.ParcelFileDescriptor; | ||
import android.provider.DocumentsProvider; | ||
|
||
import java.io.FileNotFoundException; | ||
|
||
public class MyContentProvider extends DocumentsProvider { | ||
|
||
private final static String[] rootColumns = new String[]{ | ||
"_id", "root_id", "title", "icon" | ||
}; | ||
private final static String[] docColumns = new String[]{ | ||
"_id", "document_id", "_display_name", "mime_type", "icon" | ||
}; | ||
|
||
MatrixCursor matrixCursor; | ||
MatrixCursor matrixRootCursor; | ||
|
||
@Override | ||
public boolean onCreate() { | ||
|
||
matrixRootCursor = new MatrixCursor(rootColumns); | ||
matrixRootCursor.addRow(new Object[]{1, 1, "TEST", R.mipmap.ic_launcher}); | ||
|
||
matrixCursor = new MatrixCursor(docColumns); | ||
matrixCursor.addRow(new Object[]{1, 1, "a.pdf", "application/pdf", R.mipmap.ic_launcher}); | ||
matrixCursor.addRow(new Object[]{2, 2, "b.pdf", "application/pdf", R.mipmap.ic_launcher}); | ||
matrixCursor.addRow(new Object[]{3, 3, "c.pdf", "application/pdf", R.mipmap.ic_launcher}); | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public Cursor queryRoots(String[] projection) throws FileNotFoundException { | ||
return matrixRootCursor; | ||
} | ||
|
||
@Override | ||
public Cursor queryDocument(String documentId, String[] projection) | ||
throws FileNotFoundException { | ||
|
||
return matrixCursor; | ||
} | ||
|
||
@Override | ||
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, | ||
String sortOrder) | ||
throws FileNotFoundException { | ||
|
||
return matrixCursor; | ||
} | ||
|
||
@Override | ||
public ParcelFileDescriptor openDocument(String documentId, String mode, | ||
CancellationSignal signal) | ||
throws FileNotFoundException { | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.