Java Code Examples for android.view.accessibility.AccessibilityNodeInfo#setScrollable()
The following examples show how to use
android.view.accessibility.AccessibilityNodeInfo#setScrollable() .
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: HorizontalScrollView.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); final int scrollRange = getScrollRange(); if (scrollRange > 0) { info.setScrollable(true); if (isEnabled() && mScrollX > 0) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_LEFT); } if (isEnabled() && mScrollX < scrollRange) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_RIGHT); } } }
Example 2
Source File: ScrollView.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); if (isEnabled()) { final int scrollRange = getScrollRange(); if (scrollRange > 0) { info.setScrollable(true); if (mScrollY > 0) { info.addAction( AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP); } if (mScrollY < scrollRange) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_DOWN); } } } }
Example 3
Source File: SdkCenteredViewPager.java From Android-SDK-Demo with MIT License | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo( host, info ); info.setClassName( SdkCenteredViewPager.class.getName() ); info.setScrollable( canScroll() ); if ( canScrollHorizontally( 1 ) ) { info.addAction( AccessibilityNodeInfo.ACTION_SCROLL_FORWARD ); } if ( canScrollHorizontally( -1 ) ) { info.addAction( AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD ); } }
Example 4
Source File: PagedView.java From LB-Launcher with Apache License 2.0 | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setScrollable(getPageCount() > 1); if (getCurrentPage() < getPageCount() - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } if (getCurrentPage() > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } }
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 |
@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); node.setMovementGranularities( AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE); if (mAccessibilityFocusId == virtualViewId) { node.setAccessibilityFocused(true); } else { node.setAccessibilityFocused(false); } }
Example 7
Source File: PagedView.java From TurboLauncher with Apache License 2.0 | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setScrollable(getPageCount() > 1); if (getCurrentPage() < getPageCount() - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } if (getCurrentPage() > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } }
Example 8
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 9
Source File: IcsAdapterView.java From Libraries-for-Android-Developers 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 10
Source File: AdapterView.java From Klyph with MIT License | 5 votes |
@TargetApi(14) @Override 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 11
Source File: SdkCenteredViewPager.java From Android-SDK-Demo with MIT License | 5 votes |
@Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo( host, info ); info.setClassName( SdkCenteredViewPager.class.getName() ); info.setScrollable( canScroll() ); if ( canScrollHorizontally( 1 ) ) { info.addAction( AccessibilityNodeInfo.ACTION_SCROLL_FORWARD ); } if ( canScrollHorizontally( -1 ) ) { info.addAction( AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD ); } }
Example 12
Source File: IcsAdapterView.java From zhangshangwuda with Apache License 2.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 13
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 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: 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 16
Source File: Gallery.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(mItemCount > 1); if (isEnabled()) { if (mItemCount > 0 && mSelectedPosition < mItemCount - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } if (isEnabled() && mItemCount > 0 && mSelectedPosition > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } }
Example 17
Source File: NumberPicker.java From zen4android with MIT License | 4 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(NumberPicker.class.getName()); info.setPackageName(getContext().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); /** TODO: Figure out compat implementation for this 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; }
Example 18
Source File: TextPicker.java From GifAssistant with Apache License 2.0 | 4 votes |
private AccessibilityNodeInfo createAccessibilityNodeInfoForNumberPicker(int left, int top, int right, int bottom) { AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(); info.setClassName(TextPicker.class.getName()); info.setPackageName(getContext().getPackageName()); info.setSource(TextPicker.this); if (hasVirtualDecrementButton()) { info.addChild(TextPicker.this, VIRTUAL_VIEW_ID_DECREMENT); } info.addChild(TextPicker.this, VIRTUAL_VIEW_ID_INPUT); if (hasVirtualIncrementButton()) { info.addChild(TextPicker.this, VIRTUAL_VIEW_ID_INCREMENT); } info.setParent((View) getParentForAccessibility()); info.setEnabled(TextPicker.this.isEnabled()); info.setScrollable(true); /** TODO: Figure out compat implementation for this 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 (TextPicker.this.isEnabled()) { if (getWrapSelectorWheel() || getValue() < getMaxValue()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } if (getWrapSelectorWheel() || getValue() > getMinValue()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } return info; }
Example 19
Source File: MultiSlider.java From MultiSlider with Apache License 2.0 | 4 votes |
@Override public AccessibilityNodeInfo createAccessibilityNodeInfo(int thumbId) { AccessibilityNodeInfo info = null; if (thumbId == View.NO_ID) { // We are requested to create an AccessibilityNodeInfo describing // this View, i.e. the root of the virtual sub-tree. Note that the // host View has an AccessibilityNodeProvider which means that this // provider is responsible for creating the node info for that root. info = AccessibilityNodeInfo.obtain(MultiSlider.this); onInitializeAccessibilityNodeInfo(info); // Add the virtual children of the root View. final int childCount = mThumbs.size(); for (int i = 0; i < childCount; i++) { info.addChild(MultiSlider.this, i); } if (mThumbs.size() == 1) { info.setScrollable(true); if (Build.VERSION.SDK_INT >= 21) { info.addAction(ACTION_SET_PROGRESS); info.addAction(ACTION_SCROLL_BACKWARD); info.addAction(ACTION_SCROLL_FORWARD); } else { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } } } else { // Find the view that corresponds to the given id. Thumb thumb = mThumbs.get(thumbId); if (thumb == null) { return null; } // Obtain and initialize an AccessibilityNodeInfo with // information about the virtual view. info = AccessibilityNodeInfo.obtain(MultiSlider.this, thumbId); info.setClassName(thumb.getClass().getName()); info.setParent(MultiSlider.this); info.setSource(MultiSlider.this, thumbId); info.setContentDescription("Multi-Slider thumb no:" + thumbId); if (Build.VERSION.SDK_INT >= 21) { info.addAction(ACTION_SET_PROGRESS); if (thumb.getPossibleMax() > thumb.value) { info.addAction(ACTION_SCROLL_BACKWARD); } if (thumb.getPossibleMax() > thumb.value) { info.addAction(ACTION_SCROLL_FORWARD); } } else { if (thumb.getPossibleMin() > thumb.value) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } if (thumb.getPossibleMax() > thumb.value) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } } if (thumb.getThumb() != null) { int[] loc = new int[2]; getLocationOnScreen(loc); Rect rect = thumb.getThumb().copyBounds(); rect.top += loc[1]; rect.left += loc[0]; rect.right += loc[0]; rect.bottom += loc[1]; info.setBoundsInScreen(rect); //TODO somehow this resuls in [0,0][0,0]. wonder check why //info.setBoundsInParent(rect); } info.setText(thumb.tag + ": " + thumb.value); info.setEnabled(thumb.isEnabled()); if (Build.VERSION.SDK_INT >= 24) { info.setImportantForAccessibility(true); } info.setVisibleToUser(true); info.setScrollable(true); } return info; }
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; }