Java Code Examples for android.widget.TextView#isTextSelectable()

The following examples show how to use android.widget.TextView#isTextSelectable() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: sa-sdk-android   File: VisualUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean isForbiddenClick(View v) {
    if (v instanceof WebView || ViewUtil.instanceOfX5WebView(v) || v instanceof AdapterView) {
        return true;
    }
    if (v instanceof TextView) {
        TextView textView = (TextView) v;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
            if (textView.isTextSelectable() && !textView.hasOnClickListeners()) {
                return true;
            }
        }
    }
    return false;
}
 
Example 2
private static void startSelection(TextView textView, int start, int end) {
    final CharSequence text = textView.getText();
    if (SUPPORTED && start >= 0 && end > start && textView.isTextSelectable() && text instanceof Spannable) {
        final Spannable spannable = (Spannable) text;
        start = Math.min(start, spannable.length());
        end = Math.min(end, spannable.length());
        Selection.setSelection(spannable, start, end);
        try {
            final Object editor = FIELD_EDITOR != null ? FIELD_EDITOR.get(textView) : textView;
            METHOD_START_SELECTION.invoke(editor);
        } catch (Exception e) {
        }
    }
}
 
Example 3
private static void startSelection(TextView textView, int start, int end) {
    final CharSequence text = textView.getText();
    if (SUPPORTED && start >= 0 && end > start && textView.isTextSelectable() && text instanceof Spannable) {
        final Spannable spannable = (Spannable) text;
        start = Math.min(start, spannable.length());
        end = Math.min(end, spannable.length());
        Selection.setSelection(spannable, start, end);
        try {
            final Object editor = FIELD_EDITOR != null ? FIELD_EDITOR.get(textView) : textView;
            METHOD_START_SELECTION.invoke(editor);
        } catch (Exception e) {
        }
    }
}
 
Example 4
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static boolean isTextSelectable(TextView textView) {
    return textView.isTextSelectable();
}