TextModelpublic class TextModel extends RegionMediaModel
Fields Summary |
---|
private static final String | TAG | private CharSequence | mText | private final int | mCharset |
Constructors Summary |
---|
public TextModel(android.content.Context context, String contentType, String src, RegionModel region)
this(context, contentType, src, CharacterSets.UTF_8, new byte[0], region);
| public TextModel(android.content.Context context, String contentType, String src, int charset, byte[] data, RegionModel region)
super(context, SmilHelper.ELEMENT_TAG_TEXT, contentType, src,
data != null ? data : new byte[0], region);
if (charset == CharacterSets.ANY_CHARSET) {
// By default, we use ISO_8859_1 to decode the data
// which character set wasn't set.
charset = CharacterSets.ISO_8859_1;
}
mCharset = charset;
mText = extractTextFromData(data);
| public TextModel(android.content.Context context, String contentType, String src, int charset, com.android.mms.drm.DrmWrapper wrapper, RegionModel regionModel)
super(context, SmilHelper.ELEMENT_TAG_TEXT, contentType, src, wrapper, regionModel);
if (charset == CharacterSets.ANY_CHARSET) {
// By default, we use ISO_8859_1 to decode the data
// which character set wasn't set.
charset = CharacterSets.ISO_8859_1;
}
mCharset = charset;
|
Methods Summary |
---|
public void | cloneText()
mText = new String(mText.toString());
| private java.lang.CharSequence | extractTextFromData(byte[] data)
if (data != null) {
try {
if (CharacterSets.ANY_CHARSET == mCharset) {
return new String(data); // system default encoding.
} else {
String name = CharacterSets.getMimeName(mCharset);
return new String(data, name);
}
} catch (UnsupportedEncodingException e) {
Log.e(TAG, "Unsupported encoding: " + mCharset, e);
return new String(data); // system default encoding.
}
}
return "";
| public int | getCharset()
return mCharset;
| public java.lang.String | getText()
if (mText == null) {
try {
mText = extractTextFromData(getData());
} catch (DrmException e) {
Log.e(TAG, e.getMessage(), e);
// Display DRM error message in place.
mText = e.getMessage();
}
}
// If our internal CharSequence is not already a String,
// re-save it as a String so subsequent calls to getText will
// be less expensive.
if (!(mText instanceof String)) {
mText = mText.toString();
}
return mText.toString();
| public void | handleEvent(org.w3c.dom.events.Event evt)
if (evt.getType().equals(SmilMediaElementImpl.SMIL_MEDIA_START_EVENT)) {
mVisible = true;
} else if (mFill != ElementTime.FILL_FREEZE) {
mVisible = false;
}
notifyModelChanged(false);
| public void | setText(java.lang.CharSequence text)
mText = text;
notifyModelChanged(true);
|
|