Fields Summary |
---|
public static final String | MIMETYPE_TEXT_PLAINThe MIME type for a clip holding plain text. |
public static final String | MIMETYPE_TEXT_HTMLThe MIME type for a clip holding HTML text. |
public static final String | MIMETYPE_TEXT_URILISTThe MIME type for a clip holding one or more URIs. This should be
used for URIs that are meaningful to a user (such as an http: URI).
It should not be used for a content: URI that references some
other piece of data; in that case the MIME type should be the type
of the referenced data. |
public static final String | MIMETYPE_TEXT_INTENTThe MIME type for a clip holding an Intent. |
final CharSequence | mLabel |
final String[] | mMimeTypes |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
public static boolean | compareMimeTypes(java.lang.String concreteType, java.lang.String desiredType)Helper to compare two MIME types, where one may be a pattern.
final int typeLength = desiredType.length();
if (typeLength == 3 && desiredType.equals("*/*")) {
return true;
}
final int slashpos = desiredType.indexOf('/");
if (slashpos > 0) {
if (typeLength == slashpos+2 && desiredType.charAt(slashpos+1) == '*") {
if (desiredType.regionMatches(0, concreteType, 0, slashpos+1)) {
return true;
}
} else if (desiredType.equals(concreteType)) {
return true;
}
}
return false;
|
public int | describeContents()
return 0;
|
public java.lang.String[] | filterMimeTypes(java.lang.String mimeType)Filter the clip description MIME types by the given MIME type. Returns
all MIME types in the clip that match the given MIME type.
ArrayList<String> array = null;
for (int i=0; i<mMimeTypes.length; i++) {
if (compareMimeTypes(mMimeTypes[i], mimeType)) {
if (array == null) {
array = new ArrayList<String>();
}
array.add(mMimeTypes[i]);
}
}
if (array == null) {
return null;
}
String[] rawArray = new String[array.size()];
array.toArray(rawArray);
return rawArray;
|
public java.lang.CharSequence | getLabel()Return the label for this clip.
return mLabel;
|
public java.lang.String | getMimeType(int index)Return one of the possible clip MIME types.
return mMimeTypes[index];
|
public int | getMimeTypeCount()Return the number of MIME types the clip is available in.
return mMimeTypes.length;
|
public boolean | hasMimeType(java.lang.String mimeType)Check whether the clip description contains the given MIME type.
for (int i=0; i<mMimeTypes.length; i++) {
if (compareMimeTypes(mMimeTypes[i], mimeType)) {
return true;
}
}
return false;
|
public boolean | toShortString(java.lang.StringBuilder b)
boolean first = true;
for (int i=0; i<mMimeTypes.length; i++) {
if (!first) {
b.append(' ");
}
first = false;
b.append(mMimeTypes[i]);
}
if (mLabel != null) {
if (!first) {
b.append(' ");
}
first = false;
b.append('"");
b.append(mLabel);
b.append('"");
}
return !first;
|
public java.lang.String | toString()
StringBuilder b = new StringBuilder(128);
b.append("ClipDescription { ");
toShortString(b);
b.append(" }");
return b.toString();
|
public void | validate()
if (mMimeTypes == null) {
throw new NullPointerException("null mime types");
}
if (mMimeTypes.length <= 0) {
throw new IllegalArgumentException("must have at least 1 mime type");
}
for (int i=0; i<mMimeTypes.length; i++) {
if (mMimeTypes[i] == null) {
throw new NullPointerException("mime type at " + i + " is null");
}
}
|
public void | writeToParcel(android.os.Parcel dest, int flags)
TextUtils.writeToParcel(mLabel, dest, flags);
dest.writeStringArray(mMimeTypes);
|