diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-09-18 18:03:49 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-09-18 18:03:49 -0700 |
commit | 563ee0fbe99c234f3364044cb762a75abbbaa797 (patch) | |
tree | 09c4a3149195e3a0bfd822395ede49e7100adbc9 /packages/DocumentsUI/src/com | |
parent | e20a3acdc2d52c7eeb76940206145b3c419394a6 (diff) | |
download | frameworks_base-563ee0fbe99c234f3364044cb762a75abbbaa797.zip frameworks_base-563ee0fbe99c234f3364044cb762a75abbbaa797.tar.gz frameworks_base-563ee0fbe99c234f3364044cb762a75abbbaa797.tar.bz2 |
Latest UX asset drop.
Darker action bar overflow icon, larger grid-mode directory icon,
icon for music albums, generic file icon.
Fix bug that allowed null MIME types to be picked.
Bug: 10700025
Change-Id: I2089678eaf793bc3c7214b21c9de5f38429ebb0f
Diffstat (limited to 'packages/DocumentsUI/src/com')
3 files changed, 28 insertions, 6 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java index 5b6ec4d..4c2c99c 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java @@ -781,7 +781,8 @@ public class DirectoryFragment extends Fragment { iconMime.setImageDrawable( IconUtils.loadPackageIcon(context, docAuthority, docIcon)); } else { - iconMime.setImageDrawable(IconUtils.loadMimeIcon(context, docMimeType)); + iconMime.setImageDrawable(IconUtils.loadMimeIcon( + context, docMimeType, docAuthority, docId, state.derivedMode)); } } diff --git a/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java b/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java index 5caf9ba..1f7386c 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java +++ b/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java @@ -22,6 +22,7 @@ import android.content.pm.ProviderInfo; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.provider.DocumentsContract.Document; +import android.util.Log; import com.google.android.collect.Maps; @@ -206,6 +207,27 @@ public class IconUtils { return null; } + public static Drawable loadMimeIcon( + Context context, String mimeType, String authority, String docId, int mode) { + final Resources res = context.getResources(); + + if (Document.MIME_TYPE_DIR.equals(mimeType)) { + // TODO: eventually move these hacky assets into that package + if ("com.android.providers.media.documents".equals(authority) + && docId.startsWith("album")) { + return res.getDrawable(R.drawable.ic_doc_album); + } + + if (mode == DocumentsActivity.State.MODE_GRID) { + return res.getDrawable(R.drawable.ic_grid_folder); + } else { + return res.getDrawable(R.drawable.ic_root_folder); + } + } + + return loadMimeIcon(context, mimeType); + } + public static Drawable loadMimeIcon(Context context, String mimeType) { final Resources res = context.getResources(); @@ -236,8 +258,7 @@ public class IconUtils { } else if ("video".equals(typeOnly)) { return res.getDrawable(R.drawable.ic_doc_video); } else { - // TODO: generic icon? - return null; + return res.getDrawable(R.drawable.ic_doc_generic); } } } diff --git a/packages/DocumentsUI/src/com/android/documentsui/MimePredicate.java b/packages/DocumentsUI/src/com/android/documentsui/MimePredicate.java index 2d96876..9df55a0 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/MimePredicate.java +++ b/packages/DocumentsUI/src/com/android/documentsui/MimePredicate.java @@ -80,10 +80,10 @@ public class MimePredicate implements Predicate<DocumentInfo> { } public static boolean mimeMatches(String filter, String test) { - if (filter == null || "*/*".equals(filter)) { - return true; - } else if (test == null) { + if (test == null) { return false; + } else if (filter == null || "*/*".equals(filter)) { + return true; } else if (filter.equals(test)) { return true; } else if (filter.endsWith("/*")) { |