Home | History | Annotate | Download | only in content

Lines Matching refs:Item

36  * <p>ClippedData is a complex type containing one or Item instances,
37 * each of which can hold one or more representations of an item of data.
49 * <p>Each Item instance can be one of three main classes of data: a simple
50 * CharSequence of text, a single Intent object, or a Uri. See {@link Item}
57 * the application must correctly interpret the data for its use. If the {@link Item}
64 * can use the convenience method {@link Item#coerceToText Item.coerceToText}.
67 * since any clip item an always be converted to a string.
70 * "content:" URIs. A content URI allows the recipient of a ClippedData item
93 * <p>For example, the implementation of {@link Item#coerceToText Item.coerceToText}
103 * is to contain a simple text, Intent, or URI, this is easy: an {@link Item}
134 * into an editor), then {@link Item#coerceToText(Context)} will ask the content
149 final ArrayList<Item> mItems = new ArrayList<Item>();
152 * Description of a single item in a ClippedData.
154 * <p>The types than an individual item can currently contain are:</p>
162 * to create when pasting a clipped item on to the home screen.
170 public static class Item {
176 * Create an Item consisting of a single block of (possibly styled) text.
178 public Item(CharSequence text) {
185 * Create an Item consisting of an arbitrary Intent.
187 public Item(Intent intent) {
194 * Create an Item consisting of an arbitrary URI.
196 public Item(Uri uri) {
203 * Create a complex Item, containing multiple representations of
206 public Item(CharSequence text, Intent intent, Uri uri) {
213 * Retrieve the raw text contained in this Item.
220 * Retrieve the raw Intent contained in this Item.
227 * Retrieve the raw URI contained in this Item.
234 * Turn this item into text, regardless of the type of data it
252 * @return Returns the item's textual representation.
256 // If this Item has an explicit textual value, simply return that.
261 // If this Item has a URI value, try using that.
324 * @param item The contents of the first item in the clip.
326 public ClipData(CharSequence label, String[] mimeTypes, Item item) {
328 if (item == null) {
329 throw new NullPointerException("item is null");
332 mItems.add(item);
339 * @param item The contents of the first item in the clip.
341 public ClipData(ClipDescription description, Item item) {
343 if (item == null) {
344 throw new NullPointerException("item is null");
347 mItems.add(item);
359 Item item = new Item(text);
360 return new ClipData(label, MIMETYPES_TEXT_PLAIN, item);
372 Item item = new Item(intent);
373 return new ClipData(label, MIMETYPES_TEXT_INTENT, item);
389 Item item = new Item(uri);
413 return new ClipData(label, mimeTypes, item);
428 Item item = new Item(uri);
429 return new ClipData(label, MIMETYPES_TEXT_URILIST, item);
441 * Add a new Item to the overall ClipData container.
443 public void addItem(Item item) {
444 if (item == null) {
445 throw new NullPointerException("item is null");
447 mItems.add(item);
463 * Return a single item inside of the clip data. The index can range
466 public Item getItemAt(int index) {
487 Item item = mItems.get(i);
488 TextUtils.writeToParcel(item.mText, dest, flags);
489 if (item.mIntent != null) {
491 item.mIntent.writeToParcel(dest, flags);
495 if (item.mUri != null) {
497 item.mUri.writeToParcel(dest, flags);
516 mItems.add(new Item(text, intent, uri));