Java Code Examples for android.view.View#announceForAccessibility()
The following examples show how to use
android.view.View#announceForAccessibility() .
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: WallpaperPickerActivity.java From Trebuchet with GNU General Public License v3.0 | 5 votes |
@Thunk void selectTile(View v) { if (mSelectedTile != null) { mSelectedTile.setSelected(false); mSelectedTile = null; } mSelectedTile = v; v.setSelected(true); mSelectedIndex = mWallpapersView.indexOfChild(v); // TODO: Remove this once the accessibility framework and // services have better support for selection state. v.announceForAccessibility( getContext().getString(R.string.announce_selection, v.getContentDescription())); }
Example 2
Source File: Utils.java From MaterialDateRangePicker with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 3
Source File: Utils.java From AlarmOn with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 4
Source File: Utils.java From StyleableDateTimePicker with MIT License | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 5
Source File: SuntimesUtils.java From SuntimesWidget with GNU General Public License v3.0 | 5 votes |
/** * @param view the View to trigger the accessibility event * @param msg text that will be read aloud (if accessibility enabled) */ public static void announceForAccessibility(View view, String msg) { if (view != null && msg != null) { if (Build.VERSION.SDK_INT >= 16) { view.announceForAccessibility(msg); } else { Context context = view.getContext(); if (context != null) { AccessibilityManager accesibility = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); if (accesibility != null && accesibility.isEnabled()) { AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED); event.getText().add(msg); event.setEnabled(view.isEnabled()); event.setClassName(view.getClass().getName()); event.setPackageName(context.getPackageName()); ViewParent parent = view.getParent(); if (Build.VERSION.SDK_INT >= 14 && parent != null) { parent.requestSendAccessibilityEvent(view, event); } else { accesibility.sendAccessibilityEvent(event); } } } } } }
Example 6
Source File: Utils.java From Conquer with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 7
Source File: WallpaperPickerActivity.java From TurboLauncher with Apache License 2.0 | 5 votes |
private void selectTile(View v) { if (mSelectedTile != null) { mSelectedTile.setSelected(false); mSelectedTile = null; } mSelectedTile = v; v.setSelected(true); mSelectedIndex = mWallpapersView.indexOfChild(v); // TODO: Remove this once the accessibility framework and // services have better support for selection state. v.announceForAccessibility( getString(R.string.announce_selection, v.getContentDescription())); }
Example 8
Source File: Utils.java From DateTimepicker with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 9
Source File: Utils.java From PersianDateRangePicker with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (view != null && text != null) { view.announceForAccessibility(text); } }
Example 10
Source File: Utils.java From date_picker_converter with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 11
Source File: Utils.java From Android-SwitchDateTimePicker with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (Build.VERSION.SDK_INT >= 16 && view != null && text != null) { view.announceForAccessibility(text); } }
Example 12
Source File: Utils.java From cathode with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 13
Source File: Utils.java From ClockPlus with GNU General Public License v3.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 14
Source File: Utils.java From narrate-android with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 15
Source File: Utils.java From AssistantBySDK with Apache License 2.0 | 5 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ @SuppressLint("NewApi") public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (isJellybeanOrLater() && view != null && text != null) { view.announceForAccessibility(text); } }
Example 16
Source File: PreviewOverlay.java From Camera2 with Apache License 2.0 | 5 votes |
/** * Zooms camera out when in accessibility mode. * * @param view is the current view * @param maxZoom is the maximum zoom value on the given device * @return float representing the current zoom value */ public float zoomOut(View view, float maxZoom) { mCurrA11yZoomLevel--; mMaxZoom = maxZoom; mCurrA11yZoom = getZoomAtLevel(mCurrA11yZoomLevel); mZoomListener.onZoomValueChanged(mCurrA11yZoom); view.announceForAccessibility(String.format( view.getResources(). getString(R.string.accessibility_zoom_announcement), mCurrA11yZoom)); return mCurrA11yZoom; }
Example 17
Source File: PreviewOverlay.java From Camera2 with Apache License 2.0 | 5 votes |
/** * uZooms camera in when in accessibility mode. * * @param view is the current view * @param maxZoom is the maximum zoom value on the given device * @return float representing the current zoom value */ public float zoomIn(View view, float maxZoom) { mCurrA11yZoomLevel++; mMaxZoom = maxZoom; mCurrA11yZoom = getZoomAtLevel(mCurrA11yZoomLevel); mZoomListener.onZoomValueChanged(mCurrA11yZoom); view.announceForAccessibility(String.format( view.getResources(). getString(R.string.accessibility_zoom_announcement), mCurrA11yZoom)); return mCurrA11yZoom; }
Example 18
Source File: ViewCompatUtils.java From AppCompat-Extension-Library with Apache License 2.0 | 4 votes |
public static void announceForAccessibility(View view, CharSequence text) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.announceForAccessibility(text); } // No-op on versions prior to Jellybean }
Example 19
Source File: Utils.java From MaterialDateTimePicker with Apache License 2.0 | 4 votes |
/** * Try to speak the specified text, for accessibility. Only available on JB or later. * @param text Text to announce. */ public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (view != null && text != null) { view.announceForAccessibility(text); } }
Example 20
Source File: ViewCompat_v16.java From Pi-Locker with GNU General Public License v2.0 | 2 votes |
/** * Wrapper for {@link View#announceForAccessibility(CharSequence)}. * * @param view * a view. * @param text * The announcement text. * @see View#announceForAccessibility(CharSequence) */ public static void announceForAccessibility(View view, CharSequence text) { view.announceForAccessibility(text); }