Java Code Examples for android.view.accessibility.AccessibilityEvent#setScrollable()
The following examples show how to use
android.view.accessibility.AccessibilityEvent#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: AnScrollView.java From Animer with Apache License 2.0 | 6 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setClassName(AnScrollView.class.getName()); final boolean scrollable = getScrollRange() > 0; event.setScrollable(scrollable); event.setScrollX(getScrollX()); event.setScrollY(getScrollY()); if(isVertScroll()){ event.setMaxScrollX(getScrollX()); event.setMaxScrollY(getScrollRange()); } else { event.setMaxScrollX(getScrollRange()); event.setMaxScrollY(getScrollY()); } }
Example 2
Source File: PagedView.java From Trebuchet with GNU General Public License v3.0 | 6 votes |
private void sendScrollAccessibilityEvent() { AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { if (mCurrentPage != getNextPage()) { AccessibilityEvent ev = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); ev.setScrollable(true); ev.setScrollX(getScrollX()); ev.setScrollY(getScrollY()); ev.setMaxScrollX(mMaxScrollX); ev.setMaxScrollY(0); sendAccessibilityEventUnchecked(ev); } } }
Example 3
Source File: ContentViewCore.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** * @see View#onInitializeAccessibilityEvent(AccessibilityEvent) */ public void onInitializeAccessibilityEvent(AccessibilityEvent event) { // Note: this is only used by the script-injecting accessibility code. event.setClassName(this.getClass().getName()); // Identify where the top-left of the screen currently points to. event.setScrollX(mRenderCoordinates.getScrollXPixInt()); event.setScrollY(mRenderCoordinates.getScrollYPixInt()); // The maximum scroll values are determined by taking the content dimensions and // subtracting off the actual dimensions of the ChromeView. int maxScrollXPix = Math.max(0, mRenderCoordinates.getMaxHorizontalScrollPixInt()); int maxScrollYPix = Math.max(0, mRenderCoordinates.getMaxVerticalScrollPixInt()); event.setScrollable(maxScrollXPix > 0 || maxScrollYPix > 0); // Setting the maximum scroll values requires API level 15 or higher. final int SDK_VERSION_REQUIRED_TO_SET_SCROLL = 15; if (Build.VERSION.SDK_INT >= SDK_VERSION_REQUIRED_TO_SET_SCROLL) { event.setMaxScrollX(maxScrollXPix); event.setMaxScrollY(maxScrollYPix); } }
Example 4
Source File: PagedView.java From LaunchEnr with GNU General Public License v3.0 | 6 votes |
private void sendScrollAccessibilityEvent() { AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { if (mCurrentPage != getNextPage()) { AccessibilityEvent ev = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); ev.setScrollable(true); ev.setScrollX(getScrollX()); ev.setScrollY(getScrollY()); ev.setMaxScrollX(mMaxScrollX); ev.setMaxScrollY(0); sendAccessibilityEventUnchecked(ev); } } }
Example 5
Source File: BrowserAccessibilityManager.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@CalledByNative private void setAccessibilityEventBooleanAttributes(AccessibilityEvent event, boolean checked, boolean enabled, boolean password, boolean scrollable) { event.setChecked(checked); event.setEnabled(enabled); event.setPassword(password); event.setScrollable(scrollable); }
Example 6
Source File: BrowserAccessibilityManager.java From 365browser with Apache License 2.0 | 5 votes |
@CalledByNative private void setAccessibilityEventBooleanAttributes(AccessibilityEvent event, boolean checked, boolean enabled, boolean password, boolean scrollable) { event.setChecked(checked); event.setEnabled(enabled); event.setPassword(password); event.setScrollable(scrollable); }
Example 7
Source File: AdapterView.java From Klyph with MIT License | 5 votes |
@TargetApi(14) @Override public void onInitializeAccessibilityEvent( AccessibilityEvent event ) { super.onInitializeAccessibilityEvent( event ); event.setClassName( AdapterView.class.getName() ); event.setScrollable( isScrollableForAccessibility() ); View selectedView = getSelectedView(); if ( selectedView != null ) { event.setEnabled( selectedView.isEnabled() ); } event.setCurrentItemIndex( getSelectedItemPosition() ); event.setFromIndex( getFirstVisiblePosition() ); event.setToIndex( getLastVisiblePosition() ); event.setItemCount( getCount() ); }
Example 8
Source File: TextPicker.java From GifAssistant with Apache License 2.0 | 5 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setClassName(TextPicker.class.getName()); event.setScrollable(true); event.setScrollY((mMinValue + mValue) * mSelectorElementHeight); event.setMaxScrollY((mMaxValue - mMinValue) * mSelectorElementHeight); }
Example 9
Source File: NumberPicker.java From ticdesign with Apache License 2.0 | 5 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setClassName(NumberPicker.class.getName()); event.setScrollable(true); event.setScrollY((mMinValue + mValue) * mSelectorElementHeight); event.setMaxScrollY((mMaxValue - mMinValue) * mSelectorElementHeight); }
Example 10
Source File: NumberPicker.java From DateTimePicker with Apache License 2.0 | 5 votes |
public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { event.setClassName(NumberPicker.class.getName()); event.setScrollable(true); event.setScrollY((mMinValue + mValue) * mSelectorElementHeight); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { // FIXME what about API 14? event.setMaxScrollY((mMaxValue - mMinValue) * mSelectorElementHeight); } }
Example 11
Source File: NumberPicker.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); event.setClassName(NumberPicker.class.getName()); event.setScrollable(true); event.setScrollY((mMinValue + mValue) * mSelectorElementHeight); event.setMaxScrollY((mMaxValue - mMinValue) * mSelectorElementHeight); }
Example 12
Source File: IcsAdapterView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { event.setEnabled(selectedView.isEnabled()); } event.setCurrentItemIndex(getSelectedItemPosition()); event.setFromIndex(getFirstVisiblePosition()); event.setToIndex(getLastVisiblePosition()); event.setItemCount(getCount()); }
Example 13
Source File: BrowserAccessibilityManager.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
@CalledByNative private void setAccessibilityEventBooleanAttributes(AccessibilityEvent event, boolean checked, boolean enabled, boolean password, boolean scrollable) { event.setChecked(checked); event.setEnabled(enabled); event.setPassword(password); event.setScrollable(scrollable); }
Example 14
Source File: IcsAdapterView.java From Libraries-for-Android-Developers with MIT License | 5 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { event.setEnabled(selectedView.isEnabled()); } event.setCurrentItemIndex(getSelectedItemPosition()); event.setFromIndex(getFirstVisiblePosition()); event.setToIndex(getLastVisiblePosition()); event.setItemCount(getCount()); }
Example 15
Source File: IcsAdapterView.java From android-apps with MIT License | 5 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { event.setEnabled(selectedView.isEnabled()); } event.setCurrentItemIndex(getSelectedItemPosition()); event.setFromIndex(getFirstVisiblePosition()); event.setToIndex(getLastVisiblePosition()); event.setItemCount(getCount()); }
Example 16
Source File: ScrollView.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); final boolean scrollable = getScrollRange() > 0; event.setScrollable(scrollable); event.setScrollX(mScrollX); event.setScrollY(mScrollY); event.setMaxScrollX(mScrollX); event.setMaxScrollY(getScrollRange()); }
Example 17
Source File: HorizontalScrollView.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); event.setScrollable(getScrollRange() > 0); event.setScrollX(mScrollX); event.setScrollY(mScrollY); event.setMaxScrollX(getScrollRange()); event.setMaxScrollY(mScrollY); }
Example 18
Source File: PagedView.java From LB-Launcher with Apache License 2.0 | 4 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setScrollable(true); }
Example 19
Source File: PagedView.java From Trebuchet with GNU General Public License v3.0 | 4 votes |
@Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); event.setScrollable(getPageCount() > 1); }
Example 20
Source File: AccessibilityEventCompatIcs.java From adt-leanback-support with Apache License 2.0 | 4 votes |
public static void setScrollable(AccessibilityEvent event, boolean scrollable) { event.setScrollable(scrollable); }