Java Code Examples for android.view.accessibility.AccessibilityNodeInfo#setEnabled()
The following examples show how to use
android.view.accessibility.AccessibilityNodeInfo#setEnabled() .
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: PhotoAttachPhotoCell.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setEnabled(true); if (photoEntry != null && photoEntry.isVideo) { info.setText(LocaleController.getString("AttachVideo", R.string.AttachVideo) + ", " + LocaleController.formatCallDuration(photoEntry.duration)); } else { info.setText(LocaleController.getString("AttachPhoto", R.string.AttachPhoto)); } if (checkBox.isChecked()) { info.setSelected(true); } if (Build.VERSION.SDK_INT >= 21) { info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.acc_action_open_photo, LocaleController.getString("Open", R.string.Open))); } }
Example 2
Source File: StickerEmojiCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); String descr = LocaleController.getString("AttachSticker", R.string.AttachSticker); for (int a = 0; a < sticker.attributes.size(); a++) { TLRPC.DocumentAttribute attribute = sticker.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { if (attribute.alt != null && attribute.alt.length() > 0) { emojiTextView.setText(Emoji.replaceEmoji(attribute.alt, emojiTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(16), false)); descr = attribute.alt + " " + descr; } break; } } info.setContentDescription(descr); info.setEnabled(true); }
Example 3
Source File: StickerCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info){ super.onInitializeAccessibilityNodeInfo(info); if (sticker == null) return; String emoji = null; for (int a = 0; a < sticker.attributes.size(); a++) { TLRPC.DocumentAttribute attribute = sticker.attributes.get(a); if (attribute instanceof TLRPC.TL_documentAttributeSticker) { emoji = attribute.alt != null && attribute.alt.length() > 0 ? attribute.alt : null; } } if (emoji != null) info.setText(emoji + " " + LocaleController.getString("AttachSticker", R.string.AttachSticker)); else info.setText(LocaleController.getString("AttachSticker", R.string.AttachSticker)); info.setEnabled(true); }
Example 4
Source File: IcsAdapterView.java From zen4android with MIT License | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { info.setEnabled(selectedView.isEnabled()); } }
Example 5
Source File: AdapterView.java From android-tv-launcher with MIT License | 5 votes |
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo paramAccessibilityNodeInfo) { super.onInitializeAccessibilityNodeInfo(paramAccessibilityNodeInfo); paramAccessibilityNodeInfo.setScrollable(isScrollableForAccessibility()); View localView = getSelectedView(); if (localView != null) paramAccessibilityNodeInfo.setEnabled(localView.isEnabled()); }
Example 6
Source File: BrowserAccessibilityManager.java From 365browser with Apache License 2.0 | 5 votes |
private AccessibilityNodeInfo createNodeForHost(int rootId) { // Since we don't want the parent to be focusable, but we can't remove // actions from a node, copy over the necessary fields. final AccessibilityNodeInfo result = AccessibilityNodeInfo.obtain(mView); final AccessibilityNodeInfo source = AccessibilityNodeInfo.obtain(mView); mView.onInitializeAccessibilityNodeInfo(source); // Copy over parent and screen bounds. Rect rect = new Rect(); source.getBoundsInParent(rect); result.setBoundsInParent(rect); source.getBoundsInScreen(rect); result.setBoundsInScreen(rect); // Set up the parent view, if applicable. final ViewParent parent = mView.getParentForAccessibility(); if (parent instanceof View) { result.setParent((View) parent); } // Populate the minimum required fields. result.setVisibleToUser(source.isVisibleToUser()); result.setEnabled(source.isEnabled()); result.setPackageName(source.getPackageName()); result.setClassName(source.getClassName()); // Add the Chrome root node. if (isFrameInfoInitialized()) { result.addChild(mView, rootId); } return result; }
Example 7
Source File: BrowserAccessibilityManager.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@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 8
Source File: NumberPicker.java From zen4android with MIT License | 5 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForVirtualButton(int virtualViewId, String text, int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(Button.class.getName()); info.setPackageName(getContext().getPackageName()); info.setSource(NumberPicker.this, virtualViewId); info.setParent(NumberPicker.this); info.setText(text); info.setClickable(true); info.setLongClickable(true); info.setEnabled(NumberPicker.this.isEnabled()); Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); // TODO info.setVisibleToUser(isVisibleToUser(boundsInParent)); info.setBoundsInParent(boundsInParent); Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); info.setBoundsInScreen(boundsInScreen); if (mAccessibilityFocusedView != virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } if (mAccessibilityFocusedView == virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } if (NumberPicker.this.isEnabled()) { info.addAction(AccessibilityNodeInfo.ACTION_CLICK); } return info; }
Example 9
Source File: TextPicker.java From GifAssistant with Apache License 2.0 | 5 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForVirtualButton(int virtualViewId, String text, int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(Button.class.getName()); info.setPackageName(getContext().getPackageName()); info.setSource(TextPicker.this, virtualViewId); info.setParent(TextPicker.this); info.setText(text); info.setClickable(true); info.setLongClickable(true); info.setEnabled(TextPicker.this.isEnabled()); Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); // TODO info.setVisibleToUser(isVisibleToUser(boundsInParent)); info.setBoundsInParent(boundsInParent); Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); info.setBoundsInScreen(boundsInScreen); if (mAccessibilityFocusedView != virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } if (mAccessibilityFocusedView == virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } if (TextPicker.this.isEnabled()) { info.addAction(AccessibilityNodeInfo.ACTION_CLICK); } return info; }
Example 10
Source File: ChatActionCell.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (TextUtils.isEmpty(customText) && currentMessageObject == null) { return; } info.setText(!TextUtils.isEmpty(customText) ? customText : currentMessageObject.messageText); info.setEnabled(true); }
Example 11
Source File: NumberPicker.java From ticdesign with Apache License 2.0 | 5 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForVirtualButton(int virtualViewId, String text, int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(Button.class.getName()); info.setPackageName(getContext().getPackageName()); info.setSource(NumberPicker.this, virtualViewId); info.setParent(NumberPicker.this); info.setText(text); info.setClickable(true); info.setLongClickable(true); info.setEnabled(NumberPicker.this.isEnabled()); Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); // info.setVisibleToUser(isVisibleToUser(boundsInParent)); info.setBoundsInParent(boundsInParent); Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); info.setBoundsInScreen(boundsInScreen); if (mAccessibilityFocusedView != virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } if (mAccessibilityFocusedView == virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } if (NumberPicker.this.isEnabled()) { info.addAction(AccessibilityNodeInfo.ACTION_CLICK); } return info; }
Example 12
Source File: MaterialTapTargetPrompt.java From MaterialTapTargetPrompt with Apache License 2.0 | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); @Nullable final Package viewPackage = PromptView.this.getClass().getPackage(); if (viewPackage != null) { info.setPackageName(viewPackage.getName()); } info.setSource(host); info.setClickable(true); info.setEnabled(true); info.setChecked(false); info.setFocusable(true); info.setFocused(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { info.setLabelFor(mPromptOptions.getTargetView()); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { info.setDismissable(true); } info.setContentDescription(mPromptOptions.getContentDescription()); info.setText(mPromptOptions.getContentDescription()); }
Example 13
Source File: AdapterView.java From letv with Apache License 2.0 | 5 votes |
@TargetApi(14) public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setClassName(AdapterView.class.getName()); info.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { info.setEnabled(selectedView.isEnabled()); } }
Example 14
Source File: IcsAdapterView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { info.setEnabled(selectedView.isEnabled()); } }
Example 15
Source File: ChatActionCell.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (TextUtils.isEmpty(customText) && currentMessageObject == null) { return; } info.setText(!TextUtils.isEmpty(customText) ? customText : currentMessageObject.messageText); info.setEnabled(true); }
Example 16
Source File: AdapterView.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); info.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { info.setEnabled(selectedView.isEnabled()); } }
Example 17
Source File: NumberPicker.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForVirtualButton(int virtualViewId, String text, int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(Button.class.getName()); info.setPackageName(mContext.getPackageName()); info.setSource(NumberPicker.this, virtualViewId); info.setParent(NumberPicker.this); info.setText(text); info.setClickable(true); info.setLongClickable(true); info.setEnabled(NumberPicker.this.isEnabled()); Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); info.setVisibleToUser(isVisibleToUser(boundsInParent)); info.setBoundsInParent(boundsInParent); Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); info.setBoundsInScreen(boundsInScreen); if (mAccessibilityFocusedView != virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } if (mAccessibilityFocusedView == virtualViewId) { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } if (NumberPicker.this.isEnabled()) { info.addAction(AccessibilityNodeInfo.ACTION_CLICK); } return info; }
Example 18
Source File: TextSettingsCell.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setEnabled(isEnabled()); }
Example 19
Source File: TextSettingsCell.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setEnabled(isEnabled()); }
Example 20
Source File: NumberPicker.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(NumberPicker.class.getName()); info.setPackageName(mContext.getPackageName()); info.setSource(NumberPicker.this); if (hasVirtualDecrementButton()) { info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_DECREMENT); } info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT); if (hasVirtualIncrementButton()) { info.addChild(NumberPicker.this, VIRTUAL_VIEW_ID_INCREMENT); } info.setParent((View) getParentForAccessibility()); info.setEnabled(NumberPicker.this.isEnabled()); info.setScrollable(true); final float applicationScale = getContext().getResources().getCompatibilityInfo().applicationScale; Rect boundsInParent = mTempRect; boundsInParent.set(left, top, right, bottom); boundsInParent.scale(applicationScale); info.setBoundsInParent(boundsInParent); info.setVisibleToUser(isVisibleToUser()); Rect boundsInScreen = boundsInParent; int[] locationOnScreen = mTempArray; getLocationOnScreen(locationOnScreen); boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]); boundsInScreen.scale(applicationScale); info.setBoundsInScreen(boundsInScreen); if (mAccessibilityFocusedView != View.NO_ID) { info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS); } if (mAccessibilityFocusedView == View.NO_ID) { info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS); } if (NumberPicker.this.isEnabled()) { if (getWrapSelectorWheel() || getValue() < getMaxValue()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } if (getWrapSelectorWheel() || getValue() > getMinValue()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } return info; }