diff options
Diffstat (limited to 'packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java')
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java b/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java index 9391ca9..3642478 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java +++ b/packages/DocumentsUI/src/com/android/documentsui/RecentsCreateFragment.java @@ -26,10 +26,14 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Loader; import android.database.Cursor; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.CancellationSignal; +import android.text.Spannable; +import android.text.SpannableStringBuilder; import android.text.TextUtils.TruncateAt; +import android.text.style.ImageSpan; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -181,20 +185,29 @@ public class RecentsCreateFragment extends Fragment { final ImageView icon = (ImageView) convertView.findViewById(android.R.id.icon); final TextView title = (TextView) convertView.findViewById(android.R.id.title); + final View line2 = convertView.findViewById(R.id.line2); final DocumentStack stack = getItem(position); icon.setImageDrawable(stack.root.loadIcon(context)); - final StringBuilder builder = new StringBuilder(); - for (int i = stack.size() - 1; i >= 0; i--) { + final Drawable crumb = context.getResources() + .getDrawable(R.drawable.ic_breadcrumb_arrow); + crumb.setBounds(0, 0, crumb.getIntrinsicWidth(), crumb.getIntrinsicHeight()); + + final SpannableStringBuilder builder = new SpannableStringBuilder(); + builder.append(stack.root.title); + appendDrawable(builder, crumb); + for (int i = stack.size() - 2; i >= 0; i--) { builder.append(stack.get(i).displayName); if (i > 0) { - builder.append(" \u232a "); + appendDrawable(builder, crumb); } } - title.setText(builder.toString()); + title.setText(builder); title.setEllipsize(TruncateAt.MIDDLE); + line2.setVisibility(View.GONE); + return convertView; } @@ -213,4 +226,10 @@ public class RecentsCreateFragment extends Fragment { return getItem(position).hashCode(); } } + + private static void appendDrawable(SpannableStringBuilder b, Drawable d) { + final int length = b.length(); + b.append("\u232a"); + b.setSpan(new ImageSpan(d), length, b.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } } |