android.text.SpanWatcher Java Examples

The following examples show how to use android.text.SpanWatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: edslite   Author: sovworks   File: EditableSecureBuffer.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example #2
Source Project: edslite   Author: sovworks   File: EditableSecureBuffer.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example #3
Source Project: edslite   Author: sovworks   File: EditableSecureBuffer.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    }
}
 
Example #4
Source Project: Dashchan   Author: Mishiranu   File: CommentTextView.java    License: Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #5
Source Project: PowerFileExplorer   Author: PowerExplorer   File: SpannableStringBuilder.java    License: GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example #6
Source Project: PowerFileExplorer   Author: PowerExplorer   File: SpannableStringBuilder.java    License: GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example #7
Source Project: PowerFileExplorer   Author: PowerExplorer   File: SpannableStringBuilder.java    License: GNU General Public License v3.0 5 votes vote down vote up
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);
    }
}
 
Example #8
Source Project: JotaTextEditor   Author: jiro-aqua   File: SpannableStringBuilder.java    License: Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example #9
Source Project: JotaTextEditor   Author: jiro-aqua   File: SpannableStringBuilder.java    License: Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example #10
Source Project: JotaTextEditor   Author: jiro-aqua   File: SpannableStringBuilder.java    License: Apache License 2.0 5 votes vote down vote up
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);
    }
}