Java Code Examples for android.view.accessibility.AccessibilityNodeInfo#setCheckable()

The following examples show how to use android.view.accessibility.AccessibilityNodeInfo#setCheckable() . 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 File: SharedLinkCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    StringBuilder sb = new StringBuilder();
    if (titleLayout != null) {
        sb.append(titleLayout.getText());
    }
    if (descriptionLayout != null) {
        sb.append(", ");
        sb.append(descriptionLayout.getText());
    }
    if (descriptionLayout2 != null) {
        sb.append(", ");
        sb.append(descriptionLayout2.getText());
    }
    if (checkBox.isChecked()) {
        info.setChecked(true);
        info.setCheckable(true);
    }
}
 
Example 2
Source File: TextCheckCell2.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.Switch");
    info.setCheckable(true);
    info.setChecked(checkBox.isChecked());
    info.setContentDescription(checkBox.isChecked() ? LocaleController.getString("NotificationsOn", R.string.NotificationsOn) : LocaleController.getString("NotificationsOff", R.string.NotificationsOff));
}
 
Example 3
Source File: RadioColorCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.RadioButton");
    info.setCheckable(true);
    info.setChecked(radioButton.isChecked());
}
 
Example 4
Source File: SharedAudioCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (currentMessageObject.isMusic()) {
        info.setText(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, currentMessageObject.getMusicAuthor(), currentMessageObject.getMusicTitle()));
    } else if (titleLayout != null && descriptionLayout != null) {
        info.setText(titleLayout.getText() + ", " + descriptionLayout.getText());
    }
    if (checkBox.isChecked()) {
        info.setCheckable(true);
        info.setChecked(true);
    }
}
 
Example 5
Source File: CheckBox.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.CheckBox");
    info.setCheckable(true);
    info.setChecked(isChecked);
}
 
Example 6
Source File: UserCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (checkBoxBig != null && checkBoxBig.getVisibility() == VISIBLE) {
        info.setCheckable(true);
        info.setChecked(checkBoxBig.isChecked());
        info.setClassName("android.widget.CheckBox");
    } else if (checkBox != null && checkBox.getVisibility() == VISIBLE) {
        info.setCheckable(true);
        info.setChecked(checkBox.isChecked());
        info.setClassName("android.widget.CheckBox");
    }
}
 
Example 7
Source File: UserCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (checkBoxBig != null && checkBoxBig.getVisibility() == VISIBLE) {
        info.setCheckable(true);
        info.setChecked(checkBoxBig.isChecked());
        info.setClassName("android.widget.CheckBox");
    } else if (checkBox != null && checkBox.getVisibility() == VISIBLE) {
        info.setCheckable(true);
        info.setChecked(checkBox.isChecked());
        info.setClassName("android.widget.CheckBox");
    }
}
 
Example 8
Source File: RadioCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.RadioButton");
    info.setCheckable(true);
    info.setChecked(isChecked());
}
 
Example 9
Source File: RadioButtonCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.RadioButton");
    info.setCheckable(true);
    info.setChecked(radioButton.isChecked());
}
 
Example 10
Source File: TextCheckBoxCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.CheckBox");
    info.setCheckable(true);
    info.setChecked(isChecked());
}
 
Example 11
Source File: MaterialCompoundButton.java    From MaterialRadioGroup with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(MaterialCompoundButton.class.getName());
    info.setCheckable(true);
    info.setChecked(mButtonView.isChecked());
}
 
Example 12
Source File: BrowserAccessibilityManager.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@CalledByNative
private void setAccessibilityNodeInfoBooleanAttributes(AccessibilityNodeInfo node,
        int virtualViewId, boolean checkable, boolean checked, boolean clickable,
        boolean enabled, boolean focusable, boolean focused, boolean password,
        boolean scrollable, boolean selected, boolean visibleToUser) {
    node.setCheckable(checkable);
    node.setChecked(checked);
    node.setClickable(clickable);
    node.setEnabled(enabled);
    node.setFocusable(focusable);
    node.setFocused(focused);
    node.setPassword(password);
    node.setScrollable(scrollable);
    node.setSelected(selected);
    node.setVisibleToUser(visibleToUser);

    if (focusable) {
        if (focused) {
            node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS);
        } else {
            node.addAction(AccessibilityNodeInfo.ACTION_FOCUS);
        }
    }

    if (mAccessibilityFocusId == virtualViewId) {
        node.setAccessibilityFocused(true);
        node.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
    } else {
        node.setAccessibilityFocused(false);
        node.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
    }

    if (clickable) {
        node.addAction(AccessibilityNodeInfo.ACTION_CLICK);
    }
}
 
Example 13
Source File: RadioButtonCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.RadioButton");
    info.setCheckable(true);
    info.setChecked(radioButton.isChecked());
}
 
Example 14
Source File: Switch.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.Switch");
    info.setCheckable(true);
    info.setChecked(isChecked);
    //info.setContentDescription(isChecked ? LocaleController.getString("NotificationsOn", R.string.NotificationsOn) : LocaleController.getString("NotificationsOff", R.string.NotificationsOff));
}
 
Example 15
Source File: MaterialCardView.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  info.setClassName(ACCESSIBILITY_CLASS_NAME);
  info.setCheckable(isCheckable());
  info.setClickable(isClickable());
  info.setChecked(isChecked());
}
 
Example 16
Source File: SharedPhotoVideoCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (currentMessageObject.isVideo()) {
        info.setText(LocaleController.getString("AttachVideo", R.string.AttachVideo) + ", " + LocaleController.formatCallDuration(currentMessageObject.getDuration()));
    } else {
        info.setText(LocaleController.getString("AttachPhoto", R.string.AttachPhoto));
    }
    if (checkBox.isChecked()) {
        info.setCheckable(true);
        info.setChecked(true);
    }
}
 
Example 17
Source File: AccessibilityHelper.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(host, info);
  info.setClassName(RadioButton.class.getName());
  info.setCheckable(true);
  info.setChecked(true);
}
 
Example 18
Source File: RadioColorCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.RadioButton");
    info.setCheckable(true);
    info.setChecked(radioButton.isChecked());
}
 
Example 19
Source File: ContextLinkCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    StringBuilder sbuf = new StringBuilder();
    switch (documentAttachType) {
        case DOCUMENT_ATTACH_TYPE_DOCUMENT:
            sbuf.append(LocaleController.getString("AttachDocument", R.string.AttachDocument));
            break;
        case DOCUMENT_ATTACH_TYPE_GIF:
            sbuf.append(LocaleController.getString("AttachGif", R.string.AttachGif));
            break;
        case DOCUMENT_ATTACH_TYPE_AUDIO:
            sbuf.append(LocaleController.getString("AttachAudio", R.string.AttachAudio));
            break;
        case DOCUMENT_ATTACH_TYPE_VIDEO:
            sbuf.append(LocaleController.getString("AttachVideo", R.string.AttachVideo));
            break;
        case DOCUMENT_ATTACH_TYPE_MUSIC:
            sbuf.append(LocaleController.getString("AttachMusic", R.string.AttachMusic));
            if (descriptionLayout != null && titleLayout != null) {
                sbuf.append(", ");
                sbuf.append(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, descriptionLayout.getText(), titleLayout.getText()));
            }
            break;
        case DOCUMENT_ATTACH_TYPE_STICKER:
            sbuf.append(LocaleController.getString("AttachSticker", R.string.AttachSticker));
            break;
        case DOCUMENT_ATTACH_TYPE_PHOTO:
            sbuf.append(LocaleController.getString("AttachPhoto", R.string.AttachPhoto));
            break;
        case DOCUMENT_ATTACH_TYPE_GEO:
            sbuf.append(LocaleController.getString("AttachLocation", R.string.AttachLocation));
            break;
        default:
            if (titleLayout != null && !TextUtils.isEmpty(titleLayout.getText())) {
                sbuf.append(titleLayout.getText());
            }
            if (descriptionLayout != null && !TextUtils.isEmpty(descriptionLayout.getText())) {
                if (sbuf.length() > 0)
                    sbuf.append(", ");
                sbuf.append(descriptionLayout.getText());
            }
            break;
    }
    info.setText(sbuf);
    if (checkBox != null && checkBox.isChecked()) {
        info.setCheckable(true);
        info.setChecked(true);
    }
}
 
Example 20
Source File: ContextLinkCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    StringBuilder sbuf = new StringBuilder();
    switch (documentAttachType) {
        case DOCUMENT_ATTACH_TYPE_DOCUMENT:
            sbuf.append(LocaleController.getString("AttachDocument", R.string.AttachDocument));
            break;
        case DOCUMENT_ATTACH_TYPE_GIF:
            sbuf.append(LocaleController.getString("AttachGif", R.string.AttachGif));
            break;
        case DOCUMENT_ATTACH_TYPE_AUDIO:
            sbuf.append(LocaleController.getString("AttachAudio", R.string.AttachAudio));
            break;
        case DOCUMENT_ATTACH_TYPE_VIDEO:
            sbuf.append(LocaleController.getString("AttachVideo", R.string.AttachVideo));
            break;
        case DOCUMENT_ATTACH_TYPE_MUSIC:
            sbuf.append(LocaleController.getString("AttachMusic", R.string.AttachMusic));
            if (descriptionLayout != null && titleLayout != null) {
                sbuf.append(", ");
                sbuf.append(LocaleController.formatString("AccDescrMusicInfo", R.string.AccDescrMusicInfo, descriptionLayout.getText(), titleLayout.getText()));
            }
            break;
        case DOCUMENT_ATTACH_TYPE_STICKER:
            sbuf.append(LocaleController.getString("AttachSticker", R.string.AttachSticker));
            break;
        case DOCUMENT_ATTACH_TYPE_PHOTO:
            sbuf.append(LocaleController.getString("AttachPhoto", R.string.AttachPhoto));
            break;
        case DOCUMENT_ATTACH_TYPE_GEO:
            sbuf.append(LocaleController.getString("AttachLocation", R.string.AttachLocation));
            break;
        default:
            if (titleLayout != null && !TextUtils.isEmpty(titleLayout.getText())) {
                sbuf.append(titleLayout.getText());
            }
            if (descriptionLayout != null && !TextUtils.isEmpty(descriptionLayout.getText())) {
                if (sbuf.length() > 0)
                    sbuf.append(", ");
                sbuf.append(descriptionLayout.getText());
            }
            break;
    }
    info.setText(sbuf);
    if (checkBox != null && checkBox.isChecked()) {
        info.setCheckable(true);
        info.setChecked(true);
    }
}