Java Code Examples for android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#setContentDescription()

The following examples show how to use android.support.v4.view.accessibility.AccessibilityNodeInfoCompat#setContentDescription() . 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: DrawerLayout.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());
}
 
Example 2
Source File: H.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private void a(AccessibilityNodeInfoCompat accessibilitynodeinfocompat, AccessibilityNodeInfoCompat accessibilitynodeinfocompat1)
{
    Rect rect = c;
    accessibilitynodeinfocompat1.getBoundsInParent(rect);
    accessibilitynodeinfocompat.setBoundsInParent(rect);
    accessibilitynodeinfocompat1.getBoundsInScreen(rect);
    accessibilitynodeinfocompat.setBoundsInScreen(rect);
    accessibilitynodeinfocompat.setVisibleToUser(accessibilitynodeinfocompat1.isVisibleToUser());
    accessibilitynodeinfocompat.setPackageName(accessibilitynodeinfocompat1.getPackageName());
    accessibilitynodeinfocompat.setClassName(accessibilitynodeinfocompat1.getClassName());
    accessibilitynodeinfocompat.setContentDescription(accessibilitynodeinfocompat1.getContentDescription());
    accessibilitynodeinfocompat.setEnabled(accessibilitynodeinfocompat1.isEnabled());
    accessibilitynodeinfocompat.setClickable(accessibilitynodeinfocompat1.isClickable());
    accessibilitynodeinfocompat.setFocusable(accessibilitynodeinfocompat1.isFocusable());
    accessibilitynodeinfocompat.setFocused(accessibilitynodeinfocompat1.isFocused());
    accessibilitynodeinfocompat.setAccessibilityFocused(accessibilitynodeinfocompat1.isAccessibilityFocused());
    accessibilitynodeinfocompat.setSelected(accessibilitynodeinfocompat1.isSelected());
    accessibilitynodeinfocompat.setLongClickable(accessibilitynodeinfocompat1.isLongClickable());
    accessibilitynodeinfocompat.addAction(accessibilitynodeinfocompat1.getActions());
    accessibilitynodeinfocompat.setMovementGranularities(accessibilitynodeinfocompat1.getMovementGranularities());
}
 
Example 3
Source File: RadialTimePickerView.java    From AppCompat-Extension-Library with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) {
    node.setClassName(getClass().getName());
    node.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK);

    final int type = getTypeFromId(virtualViewId);
    final int value = getValueFromId(virtualViewId);
    final CharSequence description = getVirtualViewDescription(type, value);
    node.setContentDescription(description);

    getBoundsForVirtualView(virtualViewId, mTempRect);
    node.setBoundsInParent(mTempRect);

    final boolean selected = isVirtualViewSelected(type, value);
    node.setSelected(selected);

    final int nextId = getVirtualViewIdAfter(type, value);
    if (nextId != INVALID_ID) {
        node.setTraversalBefore(RadialTimePickerView.this, nextId);
    }
}
 
Example 4
Source File: MarginDrawerLayout.java    From something.apk with MIT License 6 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
                                    AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());
}
 
Example 5
Source File: f.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
private void a(AccessibilityNodeInfoCompat accessibilitynodeinfocompat, AccessibilityNodeInfoCompat accessibilitynodeinfocompat1)
{
    Rect rect = c;
    accessibilitynodeinfocompat1.getBoundsInParent(rect);
    accessibilitynodeinfocompat.setBoundsInParent(rect);
    accessibilitynodeinfocompat1.getBoundsInScreen(rect);
    accessibilitynodeinfocompat.setBoundsInScreen(rect);
    accessibilitynodeinfocompat.setVisibleToUser(accessibilitynodeinfocompat1.isVisibleToUser());
    accessibilitynodeinfocompat.setPackageName(accessibilitynodeinfocompat1.getPackageName());
    accessibilitynodeinfocompat.setClassName(accessibilitynodeinfocompat1.getClassName());
    accessibilitynodeinfocompat.setContentDescription(accessibilitynodeinfocompat1.getContentDescription());
    accessibilitynodeinfocompat.setEnabled(accessibilitynodeinfocompat1.isEnabled());
    accessibilitynodeinfocompat.setClickable(accessibilitynodeinfocompat1.isClickable());
    accessibilitynodeinfocompat.setFocusable(accessibilitynodeinfocompat1.isFocusable());
    accessibilitynodeinfocompat.setFocused(accessibilitynodeinfocompat1.isFocused());
    accessibilitynodeinfocompat.setAccessibilityFocused(accessibilitynodeinfocompat1.isAccessibilityFocused());
    accessibilitynodeinfocompat.setSelected(accessibilitynodeinfocompat1.isSelected());
    accessibilitynodeinfocompat.setLongClickable(accessibilitynodeinfocompat1.isLongClickable());
    accessibilitynodeinfocompat.addAction(accessibilitynodeinfocompat1.getActions());
}
 
Example 6
Source File: DrawerLayout.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());
}
 
Example 7
Source File: DrawerLayout.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());
}
 
Example 8
Source File: CompositorViewHolder.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(
        int virtualViewId, AccessibilityNodeInfoCompat node) {
    if (mVirtualViews == null || mVirtualViews.size() <= virtualViewId) {
        // TODO(clholgat): Remove this work around when the Android bug is fixed.
        // crbug.com/420177
        node.setBoundsInParent(mPlaceHolderRect);
        node.setContentDescription(PLACE_HOLDER_STRING);
        return;
    }
    VirtualView view = mVirtualViews.get(virtualViewId);
    view.getTouchTarget(mTouchTarget);

    node.setBoundsInParent(rectToPx(mTouchTarget));
    node.setContentDescription(view.getAccessibilityDescription());
    node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
    node.addAction(AccessibilityNodeInfoCompat.ACTION_FOCUS);
    node.addAction(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
}
 
Example 9
Source File: CompositorViewHolder.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(
        int virtualViewId, AccessibilityNodeInfoCompat node) {
    if (mVirtualViews == null || mVirtualViews.size() <= virtualViewId) {
        // TODO(clholgat): Remove this work around when the Android bug is fixed.
        // crbug.com/420177
        node.setBoundsInParent(mPlaceHolderRect);
        node.setContentDescription(PLACE_HOLDER_STRING);
        return;
    }
    VirtualView view = mVirtualViews.get(virtualViewId);
    view.getTouchTarget(mTouchTarget);

    node.setBoundsInParent(rectToPx(mTouchTarget));
    node.setContentDescription(view.getAccessibilityDescription());
    node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
    node.addAction(AccessibilityNodeInfoCompat.ACTION_FOCUS);
    node.addAction(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK);
}
 
Example 10
Source File: SlidingPaneLayout.java    From letv with Apache License 2.0 6 votes vote down vote up
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest, AccessibilityNodeInfoCompat src) {
    Rect rect = this.mTmpRect;
    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);
    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);
    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());
    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());
    dest.addAction(src.getActions());
    dest.setMovementGranularities(src.getMovementGranularities());
}
 
Example 11
Source File: MonthView.java    From StyleableDateTimePicker with MIT License 5 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(int virtualViewId,
        AccessibilityNodeInfoCompat node) {
    getItemBounds(virtualViewId, mTempRect);

    node.setContentDescription(getItemDescription(virtualViewId));
    node.setBoundsInParent(mTempRect);
    node.addAction(AccessibilityNodeInfo.ACTION_CLICK);

    if (virtualViewId == mSelectedDay) {
        node.setSelected(true);
    }

}
 
Example 12
Source File: DragAndDropAccessibilityDelegate.java    From LaunchEnr with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat node) {
    if (id == INVALID_ID) {
        throw new IllegalArgumentException("Invalid virtual view id");
    }

    node.setContentDescription(getLocationDescriptionForIconDrop(id));
    node.setBoundsInParent(getItemBounds(id));

    node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK);
    node.setClickable(true);
    node.setFocusable(true);
}
 
Example 13
Source File: MonthView.java    From narrate-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(int virtualViewId,
                                            AccessibilityNodeInfoCompat node) {
    getItemBounds(virtualViewId, mTempRect);

    node.setContentDescription(getItemDescription(virtualViewId));
    node.setBoundsInParent(mTempRect);
    node.addAction(AccessibilityNodeInfo.ACTION_CLICK);

    if (virtualViewId == mSelectedDay) {
        node.setSelected(true);
    }

}
 
Example 14
Source File: SlidingPaneLayout.java    From KlyphMessenger with MIT License 5 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());

    dest.setMovementGranularities(src.getMovementGranularities());
}
 
Example 15
Source File: SlidingPaneLayout.java    From guideshow with MIT License 5 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());

    dest.setMovementGranularities(src.getMovementGranularities());
}
 
Example 16
Source File: SimpleMonthView.java    From SublimePicker with Apache License 2.0 5 votes vote down vote up
@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 17
Source File: SlidingPaneLayout.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());

    dest.setMovementGranularities(src.getMovementGranularities());
}
 
Example 18
Source File: SlidingPaneLayout.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
/**
 * This should really be in AccessibilityNodeInfoCompat, but there unfortunately
 * seem to be a few elements that are not easily cloneable using the underlying API.
 * Leave it private here as it's not general-purpose useful.
 */
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest,
        AccessibilityNodeInfoCompat src) {
    final Rect rect = mTmpRect;

    src.getBoundsInParent(rect);
    dest.setBoundsInParent(rect);

    src.getBoundsInScreen(rect);
    dest.setBoundsInScreen(rect);

    dest.setVisibleToUser(src.isVisibleToUser());
    dest.setPackageName(src.getPackageName());
    dest.setClassName(src.getClassName());
    dest.setContentDescription(src.getContentDescription());

    dest.setEnabled(src.isEnabled());
    dest.setClickable(src.isClickable());
    dest.setFocusable(src.isFocusable());
    dest.setFocused(src.isFocused());
    dest.setAccessibilityFocused(src.isAccessibilityFocused());
    dest.setSelected(src.isSelected());
    dest.setLongClickable(src.isLongClickable());

    dest.addAction(src.getActions());

    dest.setMovementGranularities(src.getMovementGranularities());
}
 
Example 19
Source File: SimpleMonthView.java    From AppCompat-Extension-Library with Apache License 2.0 5 votes vote down vote up
@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 20
Source File: MonthView.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPopulateNodeForVirtualView(int virtualViewId,
        AccessibilityNodeInfoCompat node) {
    getItemBounds(virtualViewId, mTempRect);

    node.setContentDescription(getItemDescription(virtualViewId));
    node.setBoundsInParent(mTempRect);
    node.addAction(AccessibilityNodeInfo.ACTION_CLICK);

    if (virtualViewId == mSelectedDay) {
        node.setSelected(true);
    }

}