类android.text.SpanWatcher源码实例Demo

下面列出了怎么用android.text.SpanWatcher的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: edslite   文件: EditableSecureBuffer.java
private void sendSpanAdded(Object what, int start, int end) {
    if(VERBOSE_LOG) Logger.debug(TAG + ": in sendSpanAdded");
    SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        try
        {
            recip[i].onSpanAdded(this, what, start, end);
        }
        catch (Throwable e)
        {
            Logger.log(e);
        }
    }
}
 
源代码2 项目: edslite   文件: EditableSecureBuffer.java
private void sendSpanRemoved(Object what, int start, int end) {
    if(VERBOSE_LOG) Logger.debug(TAG + ": in sendSpanRemoved");
    SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        try
        {
            recip[i].onSpanRemoved(this, what, start, end);
        }
        catch (Throwable e)
        {
            Logger.log(e);
        }
    }
}
 
源代码3 项目: edslite   文件: EditableSecureBuffer.java
private void sendSpanChanged(Object what, int oldStart, int oldEnd, int start, int end) {
    if(VERBOSE_LOG) Logger.debug(TAG + ": in sendSpanChanged");
    // The bounds of a possible SpanWatcher are guaranteed to be set before this method is
    // called, so that the order of the span does not affect this broadcast.
    SpanWatcher[] spanWatchers = getSpans(Math.min(oldStart, start),
            Math.min(Math.max(oldEnd, end), length()), SpanWatcher.class);
    int n = spanWatchers.length;
    for (int i = 0; i < n; i++) {
        try
        {
            spanWatchers[i].onSpanChanged(this, what, oldStart, oldEnd, start, end);
        }
        catch (Throwable e)
        {
            Logger.log(e);
        }
    }
}
 
源代码4 项目: Dashchan   文件: CommentTextView.java
private void invalidateSpanToClick() {
	if (spanToClick == null) {
		return;
	}
	CharSequence text = getText();
	if (text instanceof Spannable) {
		Spannable spannable = (Spannable) text;
		int start = spannable.getSpanStart(spanToClick);
		int end = spannable.getSpanEnd(spanToClick);
		if (start >= 0 && end >= start) {
			SpanWatcher[] watchers = spannable.getSpans(0, spannable.length(), SpanWatcher.class);
			if (watchers != null && watchers.length >= 1) {
				for (SpanWatcher watcher : watchers) {
					if (watcher.getClass().getName().equals("android.widget.TextView$ChangeWatcher")) {
						// Notify span changed to redraw it
						watcher.onSpanChanged(spannable, spanToClick, start, end, start, end);
					}
				}
			}
		}
	}
	invalidate();
}
 
private void sendSpanAdded(Object what, int start, int end) {
    SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        recip[i].onSpanAdded(this, what, start, end);
    }
}
 
private void sendSpanRemoved(Object what, int start, int end) {
    SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        recip[i].onSpanRemoved(this, what, start, end);
    }
}
 
private void sendSpanChanged(Object what, int s, int e, int st, int en) {
    SpanWatcher[] recip = getSpans(Math.min(s, st), Math.max(e, en),
                              SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        recip[i].onSpanChanged(this, what, s, e, st, en);
    }
}
 
源代码8 项目: JotaTextEditor   文件: SpannableStringBuilder.java
private void sendSpanAdded(Object what, int start, int end) {
    SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        recip[i].onSpanAdded(this, what, start, end);
    }
}
 
源代码9 项目: JotaTextEditor   文件: SpannableStringBuilder.java
private void sendSpanRemoved(Object what, int start, int end) {
    SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        recip[i].onSpanRemoved(this, what, start, end);
    }
}
 
源代码10 项目: JotaTextEditor   文件: SpannableStringBuilder.java
private void sendSpanChanged(Object what, int s, int e, int st, int en) {
    SpanWatcher[] recip = getSpans(Math.min(s, st), Math.max(e, en),
                              SpanWatcher.class);
    int n = recip.length;

    for (int i = 0; i < n; i++) {
        recip[i].onSpanChanged(this, what, s, e, st, en);
    }
}
 
 类所在包
 类方法
 同包方法