Example usage for android.view.accessibility AccessibilityNodeInfo setText

List of usage examples for android.view.accessibility AccessibilityNodeInfo setText

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityNodeInfo setText.

Prototype

public void setText(CharSequence text) 

Source Link

Document

Sets the text of this node.

Usage

From source file:com.android.switchaccess.test.ShadowAccessibilityNodeInfoCompat.java

@Implementation
public void setText(String text) {
    final AccessibilityNodeInfo info = (AccessibilityNodeInfo) mRealObject.getInfo();
    info.setText(text);
}

From source file:lewa.support.v7.widget.SwitchCompat.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (Build.VERSION.SDK_INT >= 14) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(SwitchCompat.class.getName());
        CharSequence switchText = isChecked() ? mTextOn : mTextOff;
        if (!TextUtils.isEmpty(switchText)) {
            CharSequence oldText = info.getText();
            if (TextUtils.isEmpty(oldText)) {
                info.setText(switchText);
            } else {
                StringBuilder newText = new StringBuilder();
                newText.append(oldText).append(' ').append(switchText);
                info.setText(newText);// w  w  w.j  a  v  a  2s  . c  o  m
            }
        }
    }
}

From source file:android.support.v7.widget.SwitchCompat.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (Build.VERSION.SDK_INT >= 14) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(ACCESSIBILITY_EVENT_CLASS_NAME);
        CharSequence switchText = isChecked() ? mTextOn : mTextOff;
        if (!TextUtils.isEmpty(switchText)) {
            CharSequence oldText = info.getText();
            if (TextUtils.isEmpty(oldText)) {
                info.setText(switchText);
            } else {
                StringBuilder newText = new StringBuilder();
                newText.append(oldText).append(' ').append(switchText);
                info.setText(newText);/*w ww .ja v a 2 s  .  c o  m*/
            }
        }
    }
}

From source file:org.mariotaku.multivalueswitch.library.MultiValueSwitch.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(ACCESSIBILITY_EVENT_CLASS_NAME);
        CharSequence switchText = getEntry(getCheckedPosition());
        if (!TextUtils.isEmpty(switchText)) {
            CharSequence oldText = info.getText();
            if (TextUtils.isEmpty(oldText)) {
                info.setText(switchText);
            } else {
                StringBuilder newText = new StringBuilder();
                newText.append(oldText).append(' ').append(switchText);
                info.setText(newText);//w ww .j  a v  a  2  s. co m
            }
        }
    }
}

From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (Build.VERSION.SDK_INT >= 14) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(SmoothSwitch.class.getName());
        CharSequence switchText = isChecked() ? mTextOn : mTextOff;
        if (!TextUtils.isEmpty(switchText)) {
            CharSequence oldText = info.getText();
            if (TextUtils.isEmpty(oldText)) {
                info.setText(switchText);
            } else {
                StringBuilder newText = new StringBuilder();
                newText.append(oldText).append(' ').append(switchText);
                info.setText(newText);//from  w ww  .ja v  a2 s .c o m
            }
        }
    }
}