summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-09-23 14:23:41 -0700
committerJeff Sharkey <jsharkey@android.com>2013-09-23 14:23:45 -0700
commitb180a65d41adc731cbff1536c7ede15174bc08e1 (patch)
tree58be4cd70b6ce9340bd334bc58b95bd54558a920 /packages
parentf9b70ab87e8f26b57ac3d8dc3b77052e747cb888 (diff)
downloadframeworks_base-b180a65d41adc731cbff1536c7ede15174bc08e1.zip
frameworks_base-b180a65d41adc731cbff1536c7ede15174bc08e1.tar.gz
frameworks_base-b180a65d41adc731cbff1536c7ede15174bc08e1.tar.bz2
Allow saving to Downloads.
Uses new column to mark writability. Also filter file selection in create mode to only allow writable files. Bug: 10667164, 10893268 Change-Id: I90f74efbb7ac634fbdb3cc02a904a96a434d3605
Diffstat (limited to 'packages')
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index 8eb121a..de1f130 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -17,6 +17,7 @@
package com.android.documentsui;
import static com.android.documentsui.DocumentsActivity.TAG;
+import static com.android.documentsui.DocumentsActivity.State.ACTION_CREATE;
import static com.android.documentsui.DocumentsActivity.State.ACTION_MANAGE;
import static com.android.documentsui.DocumentsActivity.State.MODE_GRID;
import static com.android.documentsui.DocumentsActivity.State.MODE_LIST;
@@ -887,8 +888,14 @@ public class DirectoryFragment extends Fragment {
line2.setVisibility(hasLine2 ? View.VISIBLE : View.GONE);
}
- final boolean enabled = Document.MIME_TYPE_DIR.equals(docMimeType)
+ 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;
+ }
+
if (enabled) {
setEnabledRecursive(convertView, true);
icon.setAlpha(1f);