Java Code Examples for android.view.accessibility.AccessibilityNodeInfo#setClassName()

The following examples show how to use android.view.accessibility.AccessibilityNodeInfo#setClassName() . 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: SurfaceRenderView.java    From TvPlayer with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.setClassName(SurfaceRenderView.class.getName());
    }
}
 
Example 2
Source File: RadioButtonCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName("android.widget.RadioButton");
    info.setCheckable(true);
    info.setChecked(radioButton.isChecked());
}
 
Example 3
Source File: SimpleTextView.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setVisibleToUser(true);
    info.setClassName("android.widget.TextView");
    info.setText(text);
}
 
Example 4
Source File: VolumeSlider.java    From talkback with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(host, info);
  info.setClassName(ProgressBar.class.getName());
  AudioManager audioManager =
      (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
  if ((audioManager == null) || (VERSION.SDK_INT < VERSION_CODES.N)) {
    return;
  }

  // Setting the range info on a device pre-N causes the volume percent to be always announced
  // as "0 percent." Not setting the range info on M-devices results in the percentage
  // corresponding to the volume slider to be announced. This is slightly different from the
  // actual volume percentage due to how progress bars are set. Therefore, we should prefer the
  // range info spoken feedback when possible, but when not available (i.e. on M-devices) use
  // the spoken feedback corresponding to the progress bar progress instead.
  float minVolume = audioManager.getStreamMinVolume(volumeStreamType);
  float maxVolume = audioManager.getStreamMaxVolume(volumeStreamType);
  float currentVolume = audioManager.getStreamVolume(volumeStreamType);

  // Note that this corresponds to the actual volume percentage given by the Volume Settings
  // page, which may be different than what TalkBack uses. Volume Settings calculates percentage
  // of total volume and not percentage of the valid volume range, otherwise we would subtract
  // minimum volume from the current volume.
  float percent = ((currentVolume) / (maxVolume - minVolume)) * 100;

  AccessibilityNodeInfo.RangeInfo rangeInfo =
      AccessibilityNodeInfo.RangeInfo.obtain(RangeInfo.RANGE_TYPE_PERCENT, 0, 100, percent);
  info.setRangeInfo(rangeInfo);
}
 
Example 5
Source File: DrawerLayout.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
	if (CAN_HIDE_DESCENDANTS) {
		super.onInitializeAccessibilityNodeInfo(host, info);
	} else {
		// Obtain a node for the host, then manually generate the list
		// of children to only include non-obscured views.
		final AccessibilityNodeInfo superNode = AccessibilityNodeInfo.obtain(info);
		super.onInitializeAccessibilityNodeInfo(host, superNode);

		info.setSource(host);
		final ViewParent parent = host.getParentForAccessibility();
		if (parent instanceof View) {
			info.setParent((View) parent);
		}
		copyNodeInfoNoChildren(info, superNode);
		superNode.recycle();

		addChildrenForAccessibility(info, (ViewGroup) host);
	}

	info.setClassName(DrawerLayout.class.getName());

	// This view reports itself as focusable so that it can intercept
	// the back button, but we should prevent this view from reporting
	// itself as focusable to accessibility services.
	info.setFocusable(false);
	info.setFocused(false);
	if (C.API_LOLLIPOP) {
		info.removeAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_FOCUS);
		info.removeAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLEAR_FOCUS);
	}
}
 
Example 6
Source File: CheckedTextView.java    From ticdesign with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(CheckedTextView.class.getName());
    info.setCheckable(true);
    info.setChecked(mChecked);
}
 
Example 7
Source File: AccessibilityHelper.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(host, info);
  info.setClassName(RadioButton.class.getName());
  info.setCheckable(true);
  info.setChecked(false);
}
 
Example 8
Source File: SurfaceRenderView.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        info.setClassName(SurfaceRenderView.class.getName());
    }
}
 
Example 9
Source File: MaterialCardView.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  info.setClassName(ACCESSIBILITY_CLASS_NAME);
  info.setCheckable(isCheckable());
  info.setClickable(isClickable());
  info.setChecked(isChecked());
}
 
Example 10
Source File: CircularTabLayoutAdapter.java    From CircularViewPager with MIT License 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(ActionBar.Tab.class.getName());
}
 
Example 11
Source File: VideoView.java    From imsdk-android with MIT License 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(VideoView.class.getName());
}
 
Example 12
Source File: VolBar.java    From ExVidPlayer with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(final AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  info.setClassName(VolBar.class.getName());
}
 
Example 13
Source File: AccessibleTextView.java    From MaterialDateRangePicker with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(Button.class.getName());
}
 
Example 14
Source File: PersianAccessibleTextView.java    From PersianDateRangePicker with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
  super.onInitializeAccessibilityNodeInfo(info);
  info.setClassName(Button.class.getName());
}
 
Example 15
Source File: BrowserAccessibilityManager.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@CalledByNative
private void setAccessibilityNodeInfoStringAttributes(AccessibilityNodeInfo node,
        String className, String contentDescription) {
    node.setClassName(className);
    node.setContentDescription(contentDescription);
}
 
Example 16
Source File: MediaController.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(MediaController.class.getName());
}
 
Example 17
Source File: HListView.java    From letv with Apache License 2.0 4 votes vote down vote up
@TargetApi(14)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(HListView.class.getName());
}
 
Example 18
Source File: FmMediaController.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(FmMediaController.class.getName());
}
 
Example 19
Source File: FmMediaController.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(FmMediaController.class.getName());
}
 
Example 20
Source File: AccessibleLinearLayout.java    From date_picker_converter with Apache License 2.0 4 votes vote down vote up
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(Button.class.getName());
}