Java Code Examples for android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#setChecked()
The following examples show how to use
android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#setChecked() .
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: SimpleMonthView.java From SublimePicker with Apache License 2.0 | 5 votes |
@Override protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) { final boolean hasBounds = getBoundsForDay(virtualViewId, mTempRect); if (!hasBounds) { // The day is invalid, kill the node. mTempRect.setEmpty(); node.setContentDescription(""); node.setBoundsInParent(mTempRect); node.setVisibleToUser(false); return; } node.setText(getDayText(virtualViewId)); node.setContentDescription(getDayDescription(virtualViewId)); node.setBoundsInParent(mTempRect); final boolean isDayEnabled = isDayEnabled(virtualViewId); if (isDayEnabled) { node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK); } node.setEnabled(isDayEnabled); if (mActivatedDays.isValid() && mActivatedDays.isActivated(virtualViewId)) { // TODO: This should use activated once that's supported. node.setChecked(true); } }
Example 2
Source File: SimpleMonthView.java From AppCompat-Extension-Library with Apache License 2.0 | 5 votes |
@Override protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) { final boolean hasBounds = getBoundsForDay(virtualViewId, mTempRect); if (!hasBounds) { // The day is invalid, kill the node. mTempRect.setEmpty(); node.setContentDescription(""); node.setBoundsInParent(mTempRect); node.setVisibleToUser(false); return; } node.setText(getDayText(virtualViewId)); node.setContentDescription(getDayDescription(virtualViewId)); node.setBoundsInParent(mTempRect); final boolean isDayEnabled = isDayEnabled(virtualViewId); if (isDayEnabled) { node.addAction(AccessibilityActionCompat.ACTION_CLICK); } node.setEnabled(isDayEnabled); if (virtualViewId == mActivatedDay) { // TODO: This should use activated once that's supported. node.setChecked(true); } }
Example 3
Source File: ExploreByTouchHelperActivity.java From V.FlyoutTest with MIT License | 5 votes |
@Override protected void onPopulateNodeForVirtualView( int virtualViewId, AccessibilityNodeInfoCompat node) { final CustomItem item = getItem(virtualViewId); if (item == null) { throw new IllegalArgumentException("Invalid virtual view id"); } // Node and event text and content descriptions are usually // identical, so we'll use the exact same string as before. node.setText(item.description); // Reported bounds should be consistent with those used to draw // the item in onDraw(). They should also be consistent with the // hit detection performed in getVirtualViewAt() and // onTouchEvent(). final Rect bounds = mTempRect; final int height = getHeight(); final int width = getWidth(); scaleRectF(item.bounds, bounds, width, height); node.setBoundsInParent(bounds); // Since the user can tap an item, add the CLICK action. We'll // need to handle this later in onPerformActionForVirtualView. node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK); // This item has a checked state. node.setCheckable(true); node.setChecked(item.checked); }