Wire support for archives to DocumentsUI.
Bug: 20176812 Change-Id: I8220afa2f53b07aa842bf6ac24fcc62afd4e2617
This commit is contained in:
@@ -300,10 +300,11 @@ public abstract class BaseActivity extends Activity {
|
||||
|
||||
void onDirectoryCreated(DocumentInfo doc) {
|
||||
checkArgument(doc.isDirectory());
|
||||
openDirectory(doc);
|
||||
openContainerDocument(doc);
|
||||
}
|
||||
|
||||
void openDirectory(DocumentInfo doc) {
|
||||
void openContainerDocument(DocumentInfo doc) {
|
||||
checkArgument(doc.isContainer());
|
||||
mState.stack.push(doc);
|
||||
mState.stackTouched = true;
|
||||
onCurrentDirectoryChanged(ANIM_DOWN);
|
||||
|
||||
@@ -421,8 +421,8 @@ public class DocumentsActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onDocumentPicked(DocumentInfo doc, DocumentContext context) {
|
||||
final FragmentManager fm = getFragmentManager();
|
||||
if (doc.isDirectory()) {
|
||||
openDirectory(doc);
|
||||
if (doc.isContainer()) {
|
||||
openContainerDocument(doc);
|
||||
} else if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT) {
|
||||
// Explicit file picked, return
|
||||
new ExistingFinishTask(doc.derivedUri).executeOnExecutor(getExecutorForCurrentDirectory());
|
||||
|
||||
@@ -185,8 +185,8 @@ public class DownloadsActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onDocumentPicked(DocumentInfo doc, DocumentContext context) {
|
||||
final FragmentManager fm = getFragmentManager();
|
||||
if (doc.isDirectory()) {
|
||||
openDirectory(doc);
|
||||
if (doc.isContainer()) {
|
||||
openContainerDocument(doc);
|
||||
} else {
|
||||
// First try managing the document; we expect manager to filter
|
||||
// based on authority, so we don't grant.
|
||||
|
||||
@@ -311,8 +311,8 @@ public class FilesActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public void onDocumentPicked(DocumentInfo doc, @Nullable DocumentContext siblings) {
|
||||
if (doc.isDirectory()) {
|
||||
openDirectory(doc);
|
||||
if (doc.isContainer()) {
|
||||
openContainerDocument(doc);
|
||||
} else {
|
||||
openDocument(doc, siblings);
|
||||
}
|
||||
|
||||
@@ -243,6 +243,14 @@ public class DocumentInfo implements Durable, Parcelable {
|
||||
return (flags & Document.FLAG_DIR_HIDE_GRID_TITLES) != 0;
|
||||
}
|
||||
|
||||
public boolean isArchive() {
|
||||
return (flags & Document.FLAG_ARCHIVE) != 0;
|
||||
}
|
||||
|
||||
public boolean isContainer() {
|
||||
return isDirectory() || isArchive();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return derivedUri.hashCode() + mimeType.hashCode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user