/**
* When an object of this type is attached to a Spannable, its methods
* will be called to notify it that other markup objects have been
* added, changed, or removed.
*/
public interface SpanWatcher extends NoCopySpan {
/**
* This method is called to notify you that the specified object
* has been attached to the specified range of the text.
*/
public void onSpanAdded(Spannable text, Object what, int start, int end);
/**
* This method is called to notify you that the specified object
* has been detached from the specified range of the text.
*/
public void onSpanRemoved(Spannable text, Object what, int start, int end);
/**
* This method is called to notify you that the specified object
* has been relocated from the range <code>ostart…oend</code>
* to the new range <code>nstart…nend</code> of the text.
*/
public void onSpanChanged(Spannable text, Object what, int ostart, int oend, int nstart, int nend);
}
/**
* Factory used by TextView to create new {@link Editable Editables}. You can subclass
* it to provide something other than {@link SpannableStringBuilder}.
*
* @see android.widget.TextView#setEditableFactory(Factory)
*/
public static class Factory {
private static Editable.Factory sInstance = new Editable.Factory();
/**
* Returns the standard Editable Factory.
*/
public static Editable.Factory getInstance() {
return sInstance;
}
/**
* Returns a new SpannedStringBuilder from the specified
* CharSequence. You can override this to provide
* a different kind of Spanned.
*/
public Editable newEditable(CharSequence source) {
return new SpannableStringBuilder(source);
}
}