summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/DocumentsUI/res/drawable-hdpi/ic_drawer_glyph.pngbin390 -> 389 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-hdpi/ic_menu_sortby_am.pngbin659 -> 574 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-mdpi/ic_drawer_glyph.pngbin458 -> 385 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-mdpi/ic_menu_sortby_am.pngbin594 -> 508 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-xhdpi/ic_drawer_glyph.pngbin506 -> 409 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-xhdpi/ic_menu_sortby_am.pngbin731 -> 583 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-xxhdpi/ic_drawer_glyph.pngbin203 -> 268 bytes
-rw-r--r--packages/DocumentsUI/res/drawable-xxhdpi/ic_menu_sortby_am.pngbin453 -> 373 bytes
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java45
-rw-r--r--packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java10
10 files changed, 30 insertions, 25 deletions
diff --git a/packages/DocumentsUI/res/drawable-hdpi/ic_drawer_glyph.png b/packages/DocumentsUI/res/drawable-hdpi/ic_drawer_glyph.png
index 053c0b8..251ecfb 100644
--- a/packages/DocumentsUI/res/drawable-hdpi/ic_drawer_glyph.png
+++ b/packages/DocumentsUI/res/drawable-hdpi/ic_drawer_glyph.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-hdpi/ic_menu_sortby_am.png b/packages/DocumentsUI/res/drawable-hdpi/ic_menu_sortby_am.png
index 78638f7..0d4cdc1 100644
--- a/packages/DocumentsUI/res/drawable-hdpi/ic_menu_sortby_am.png
+++ b/packages/DocumentsUI/res/drawable-hdpi/ic_menu_sortby_am.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-mdpi/ic_drawer_glyph.png b/packages/DocumentsUI/res/drawable-mdpi/ic_drawer_glyph.png
index f616d3b..ae0da34 100644
--- a/packages/DocumentsUI/res/drawable-mdpi/ic_drawer_glyph.png
+++ b/packages/DocumentsUI/res/drawable-mdpi/ic_drawer_glyph.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-mdpi/ic_menu_sortby_am.png b/packages/DocumentsUI/res/drawable-mdpi/ic_menu_sortby_am.png
index 2155d02..2768b1c 100644
--- a/packages/DocumentsUI/res/drawable-mdpi/ic_menu_sortby_am.png
+++ b/packages/DocumentsUI/res/drawable-mdpi/ic_menu_sortby_am.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-xhdpi/ic_drawer_glyph.png b/packages/DocumentsUI/res/drawable-xhdpi/ic_drawer_glyph.png
index 002ccd9..7402c6d 100644
--- a/packages/DocumentsUI/res/drawable-xhdpi/ic_drawer_glyph.png
+++ b/packages/DocumentsUI/res/drawable-xhdpi/ic_drawer_glyph.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-xhdpi/ic_menu_sortby_am.png b/packages/DocumentsUI/res/drawable-xhdpi/ic_menu_sortby_am.png
index 85c8734..f24ca1a 100644
--- a/packages/DocumentsUI/res/drawable-xhdpi/ic_menu_sortby_am.png
+++ b/packages/DocumentsUI/res/drawable-xhdpi/ic_menu_sortby_am.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-xxhdpi/ic_drawer_glyph.png b/packages/DocumentsUI/res/drawable-xxhdpi/ic_drawer_glyph.png
index adee4a3..4160699 100644
--- a/packages/DocumentsUI/res/drawable-xxhdpi/ic_drawer_glyph.png
+++ b/packages/DocumentsUI/res/drawable-xxhdpi/ic_drawer_glyph.png
Binary files differ
diff --git a/packages/DocumentsUI/res/drawable-xxhdpi/ic_menu_sortby_am.png b/packages/DocumentsUI/res/drawable-xxhdpi/ic_menu_sortby_am.png
index 867c8e8..8f19afa 100644
--- a/packages/DocumentsUI/res/drawable-xxhdpi/ic_menu_sortby_am.png
+++ b/packages/DocumentsUI/res/drawable-xxhdpi/ic_menu_sortby_am.png
Binary files differ
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index 79ab28d..138f523 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -77,7 +77,6 @@ import com.android.documentsui.DocumentsActivity.State;
import com.android.documentsui.RecentsProvider.StateColumns;
import com.android.documentsui.model.DocumentInfo;
import com.android.documentsui.model.RootInfo;
-import com.android.internal.util.Predicate;
import com.google.android.collect.Lists;
import java.util.ArrayList;
@@ -95,8 +94,6 @@ public class DirectoryFragment extends Fragment {
private AbsListView mCurrentView;
- private Predicate<DocumentInfo> mFilter;
-
public static final int TYPE_NORMAL = 1;
public static final int TYPE_SEARCH = 2;
public static final int TYPE_RECENT_OPEN = 3;
@@ -354,8 +351,6 @@ public class DirectoryFragment extends Fragment {
private void updateDisplayState() {
final State state = getDisplayState(this);
- mFilter = new MimePredicate(state.acceptMimes);
-
if (mLastMode == state.derivedMode && mLastShowSize == state.showSize) return;
mLastMode = state.derivedMode;
mLastShowSize = state.showSize;
@@ -399,8 +394,10 @@ public class DirectoryFragment extends Fragment {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Cursor cursor = mAdapter.getItem(position);
if (cursor != null) {
- final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
- if (mFilter.apply(doc)) {
+ final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
+ final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
+ if (isDocumentEnabled(docMimeType, docFlags)) {
+ final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
((DocumentsActivity) getActivity()).onDocumentPicked(doc);
}
}
@@ -479,11 +476,10 @@ public class DirectoryFragment extends Fragment {
final Cursor cursor = mAdapter.getItem(position);
if (cursor != null) {
final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
-
- // Only valid if non-directory matches filter
- final State state = getDisplayState(DirectoryFragment.this);
- valid = !Document.MIME_TYPE_DIR.equals(docMimeType)
- && MimePredicate.mimeMatches(state.acceptMimes, docMimeType);
+ final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
+ if (!Document.MIME_TYPE_DIR.equals(docMimeType)) {
+ valid = isDocumentEnabled(docMimeType, docFlags);
+ }
}
if (!valid) {
@@ -896,14 +892,7 @@ public class DirectoryFragment extends Fragment {
line2.setVisibility(hasLine2 ? View.VISIBLE : View.GONE);
}
- boolean enabled = Document.MIME_TYPE_DIR.equals(docMimeType)
- || MimePredicate.mimeMatches(state.acceptMimes, docMimeType);
-
- // Read-only files aren't actually enabled when creating
- if (state.action == ACTION_CREATE && (docFlags & Document.FLAG_SUPPORTS_WRITE) == 0) {
- enabled = false;
- }
-
+ final boolean enabled = isDocumentEnabled(docMimeType, docFlags);
if (enabled) {
setEnabledRecursive(convertView, true);
icon.setAlpha(1f);
@@ -1067,4 +1056,20 @@ public class DirectoryFragment extends Fragment {
}
}
}
+
+ private boolean isDocumentEnabled(String docMimeType, int docFlags) {
+ final State state = getDisplayState(DirectoryFragment.this);
+
+ // Read-only files are disabled when creating
+ if (state.action == ACTION_CREATE && (docFlags & Document.FLAG_SUPPORTS_WRITE) == 0) {
+ return false;
+ }
+
+ // Directories are always enabled
+ if (Document.MIME_TYPE_DIR.equals(docMimeType)) {
+ return true;
+ }
+
+ return MimePredicate.mimeMatches(state.acceptMimes, docMimeType);
+ }
}
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
index 0ef5f56..ed28da5 100644
--- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
+++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
@@ -16,7 +16,6 @@
package com.android.externalstorage;
-import android.content.ContentResolver;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.database.MatrixCursor;
@@ -166,11 +165,12 @@ public class ExternalStorageProvider extends DocumentsProvider {
int flags = 0;
- if (file.isDirectory() && file.canWrite()) {
- flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
- }
if (file.canWrite()) {
- flags |= Document.FLAG_SUPPORTS_WRITE;
+ if (file.isDirectory()) {
+ flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
+ } else {
+ flags |= Document.FLAG_SUPPORTS_WRITE;
+ }
flags |= Document.FLAG_SUPPORTS_DELETE;
}