diff options
Diffstat (limited to 'packages/DocumentsUI/src')
6 files changed, 45 insertions, 36 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java index 77595b6..00b3c87 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryContainerView.java @@ -29,12 +29,18 @@ public class DirectoryContainerView extends FrameLayout { public DirectoryContainerView(Context context) { super(context); - setClipChildren(false); } public DirectoryContainerView(Context context, AttributeSet attrs) { super(context, attrs); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); setClipChildren(false); + setClipToOutline(false); + setClipToPadding(false); } @Override diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java index 9069a55..e013cc3 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java @@ -38,6 +38,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.Loader; +import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Point; @@ -187,6 +188,7 @@ public class DirectoryFragment extends Fragment { public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = inflater.getContext(); + final Resources res = context.getResources(); final View view = inflater.inflate(R.layout.fragment_directory, container, false); mEmptyView = view.findViewById(android.R.id.empty); @@ -196,6 +198,16 @@ public class DirectoryFragment extends Fragment { mListView.setMultiChoiceModeListener(mMultiListener); mListView.setRecyclerListener(mRecycleListener); + // Indent our list divider to align with text + final Drawable divider = mListView.getDivider(); + final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left); + final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset); + if (insetLeft) { + mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0)); + } else { + mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0)); + } + mGridView = (GridView) view.findViewById(R.id.grid); mGridView.setOnItemClickListener(mItemListener); mGridView.setMultiChoiceModeListener(mMultiListener); @@ -693,11 +705,11 @@ public class DirectoryFragment extends Fragment { if (extras != null) { final String info = extras.getString(DocumentsContract.EXTRA_INFO); if (info != null) { - mFooters.add(new MessageFooter(2, R.drawable.ic_dialog_info, info)); + mFooters.add(new MessageFooter(2, R.drawable.ic_dialog_info_dark, info)); } final String error = extras.getString(DocumentsContract.EXTRA_ERROR); if (error != null) { - mFooters.add(new MessageFooter(3, R.drawable.ic_dialog_alert, error)); + mFooters.add(new MessageFooter(3, R.drawable.ic_dialog_alert_dark, error)); } if (extras.getBoolean(DocumentsContract.EXTRA_LOADING, false)) { mFooters.add(new LoadingFooter()); @@ -706,7 +718,7 @@ public class DirectoryFragment extends Fragment { if (result != null && result.exception != null) { mFooters.add(new MessageFooter( - 3, R.drawable.ic_dialog_alert, getString(R.string.query_error))); + 3, R.drawable.ic_dialog_alert_dark, getString(R.string.query_error))); } if (isEmpty()) { @@ -748,21 +760,6 @@ public class DirectoryFragment extends Fragment { convertView = inflater.inflate(R.layout.item_doc_list, parent, false); } else if (state.derivedMode == MODE_GRID) { convertView = inflater.inflate(R.layout.item_doc_grid, parent, false); - - // Apply padding to grid items - final FrameLayout grid = (FrameLayout) convertView; - final int gridPadding = getResources() - .getDimensionPixelSize(R.dimen.grid_padding); - - // Tricksy hobbitses! We need to fully clear the drawable so - // the view doesn't clobber the new InsetDrawable callback - // when setting back later. - final Drawable fg = grid.getForeground(); - final Drawable bg = grid.getBackground(); - grid.setForeground(null); - grid.setBackground(null); - grid.setForeground(new InsetDrawable(fg, gridPadding)); - grid.setBackground(new InsetDrawable(bg, gridPadding)); } else { throw new IllegalStateException(); } @@ -882,7 +879,8 @@ public class DirectoryFragment extends Fragment { // hint to remind user they're a directory. if (Document.MIME_TYPE_DIR.equals(docMimeType) && state.derivedMode == MODE_GRID && showThumbnail) { - iconDrawable = context.getResources().getDrawable(R.drawable.ic_root_folder); + iconDrawable = context.getResources().getDrawable( + R.drawable.ic_root_folder_dark); } if (summary != null) { diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java index b552e5a..c163c46 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java +++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryView.java @@ -40,8 +40,13 @@ public class DirectoryView extends FrameLayout { public void setBackground(Drawable background) { final Rect rect = new Rect(); background.getPadding(rect); - final InsetDrawable inset = new InsetDrawable(background, -rect.left, 0, -rect.right, 0); - super.setBackground(inset); + + final boolean insetLeft = getResources().getBoolean(R.bool.list_divider_inset_left); + if (insetLeft) { + super.setBackground(new InsetDrawable(background, -rect.left, 0, -rect.right, 0)); + } else { + super.setBackground(new InsetDrawable(background, -rect.right, 0, -rect.left, 0)); + } } @Override diff --git a/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java b/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java index 71fd100..eaa74eb 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java +++ b/packages/DocumentsUI/src/com/android/documentsui/IconUtils.java @@ -45,7 +45,7 @@ public class IconUtils { add("application/vnd.android.package-archive", icon); // Audio - icon = R.drawable.ic_doc_audio; + icon = R.drawable.ic_doc_audio_dark; add("application/ogg", icon); add("application/x-flac", icon); @@ -132,7 +132,7 @@ public class IconUtils { add("application/x-font-ttf", icon); // Image - icon = R.drawable.ic_doc_image; + icon = R.drawable.ic_doc_image_dark; add("application/vnd.oasis.opendocument.graphics", icon); add("application/vnd.oasis.opendocument.graphics-template", icon); add("application/vnd.oasis.opendocument.image", icon); @@ -186,7 +186,7 @@ public class IconUtils { add("application/x-kword", icon); // Video - icon = R.drawable.ic_doc_video; + icon = R.drawable.ic_doc_video_dark; add("application/x-quicktimeplayer", icon); add("application/x-shockwave-flash", icon); } @@ -220,7 +220,7 @@ public class IconUtils { if (mode == DocumentsActivity.State.MODE_GRID) { return res.getDrawable(R.drawable.ic_grid_folder); } else { - return res.getDrawable(R.drawable.ic_root_folder); + return res.getDrawable(R.drawable.ic_root_folder_dark); } } @@ -232,7 +232,7 @@ public class IconUtils { if (Document.MIME_TYPE_DIR.equals(mimeType)) { // TODO: return a mipmap, since this is used for grid - return res.getDrawable(R.drawable.ic_root_folder); + return res.getDrawable(R.drawable.ic_root_folder_dark); } // Look for exact match first @@ -249,13 +249,13 @@ public class IconUtils { // Otherwise look for partial match final String typeOnly = mimeType.split("/")[0]; if ("audio".equals(typeOnly)) { - return res.getDrawable(R.drawable.ic_doc_audio); + return res.getDrawable(R.drawable.ic_doc_audio_dark); } else if ("image".equals(typeOnly)) { - return res.getDrawable(R.drawable.ic_doc_image); + return res.getDrawable(R.drawable.ic_doc_image_dark); } else if ("text".equals(typeOnly)) { return res.getDrawable(R.drawable.ic_doc_text); } else if ("video".equals(typeOnly)) { - return res.getDrawable(R.drawable.ic_doc_video); + return res.getDrawable(R.drawable.ic_doc_video_dark); } else { return res.getDrawable(R.drawable.ic_doc_generic); } diff --git a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java index caa7581..d06e858 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java @@ -103,7 +103,7 @@ public class RootsCache { // Special root for recents mRecentsRoot.authority = null; mRecentsRoot.rootId = null; - mRecentsRoot.icon = R.drawable.ic_root_recent; + mRecentsRoot.icon = R.drawable.ic_root_recent_dark; mRecentsRoot.flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_IS_CHILD; mRecentsRoot.title = mContext.getString(R.string.root_recent); diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java index e220c9e..efa7785 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java +++ b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java @@ -159,15 +159,15 @@ public class RootInfo implements Durable, Parcelable { // TODO: remove these special case icons if (isExternalStorage()) { - derivedIcon = R.drawable.ic_root_sdcard; + derivedIcon = R.drawable.ic_root_sdcard_dark; } else if (isDownloads()) { - derivedIcon = R.drawable.ic_root_download; + derivedIcon = R.drawable.ic_root_download_dark; } else if (isImages()) { - derivedIcon = R.drawable.ic_doc_image; + derivedIcon = R.drawable.ic_doc_image_dark; } else if (isVideos()) { - derivedIcon = R.drawable.ic_doc_video; + derivedIcon = R.drawable.ic_doc_video_dark; } else if (isAudio()) { - derivedIcon = R.drawable.ic_doc_audio; + derivedIcon = R.drawable.ic_doc_audio_dark; } } |