diff --git a/packages/DocumentsUI/res/layout/item_loading.xml b/packages/DocumentsUI/res/layout/item_loading.xml
new file mode 100644
index 0000000000000..7da71e3cb4f69
--- /dev/null
+++ b/packages/DocumentsUI/res/layout/item_loading.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
diff --git a/packages/DocumentsUI/res/layout/item_message_grid.xml b/packages/DocumentsUI/res/layout/item_message_grid.xml
new file mode 100644
index 0000000000000..941340e9d720e
--- /dev/null
+++ b/packages/DocumentsUI/res/layout/item_message_grid.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/DocumentsUI/res/layout/item_message_list.xml b/packages/DocumentsUI/res/layout/item_message_list.xml
new file mode 100644
index 0000000000000..dda3c80f2baa3
--- /dev/null
+++ b/packages/DocumentsUI/res/layout/item_message_list.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
index 1220137f8e3e5..33d7d6afd18db 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DirectoryFragment.java
@@ -412,11 +412,83 @@ public class DirectoryFragment extends Fragment {
return ((DocumentsActivity) fragment.getActivity()).getDisplayState();
}
+ private interface Footer {
+ public View getView(View convertView, ViewGroup parent);
+ }
+
+ private static class LoadingFooter implements Footer {
+ @Override
+ public View getView(View convertView, ViewGroup parent) {
+ final Context context = parent.getContext();
+ if (convertView == null) {
+ final LayoutInflater inflater = LayoutInflater.from(context);
+ convertView = inflater.inflate(R.layout.item_loading, parent, false);
+ }
+ return convertView;
+ }
+ }
+
+ private class MessageFooter implements Footer {
+ private final int mIcon;
+ private final String mMessage;
+
+ public MessageFooter(int icon, String message) {
+ mIcon = icon;
+ mMessage = message;
+ }
+
+ @Override
+ public View getView(View convertView, ViewGroup parent) {
+ final Context context = parent.getContext();
+ final State state = getDisplayState(DirectoryFragment.this);
+
+ if (convertView == null) {
+ final LayoutInflater inflater = LayoutInflater.from(context);
+ if (state.mode == MODE_LIST) {
+ convertView = inflater.inflate(R.layout.item_message_list, parent, false);
+ } else if (state.mode == MODE_GRID) {
+ convertView = inflater.inflate(R.layout.item_message_grid, parent, false);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ final ImageView icon = (ImageView) convertView.findViewById(android.R.id.icon);
+ final TextView title = (TextView) convertView.findViewById(android.R.id.title);
+ icon.setImageResource(mIcon);
+ title.setText(mMessage);
+ return convertView;
+ }
+ }
+
private class DocumentsAdapter extends BaseAdapter {
private Cursor mCursor;
+ private int mCursorCount;
+
+ private List