android.view.View#announceForAccessibility ( )源码实例Demo

下面列出了android.view.View#announceForAccessibility ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: PersianDateRangePicker   文件: Utils.java
/**
 * 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);
  }
}
 
源代码2 项目: Camera2   文件: PreviewOverlay.java
/**
 * 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;
}
 
源代码3 项目: Camera2   文件: PreviewOverlay.java
/**
 * 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;
}
 
源代码4 项目: AssistantBySDK   文件: Utils.java
/**
 * 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);
    }
}
 
源代码5 项目: narrate-android   文件: Utils.java
/**
 * 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);
    }
}
 
源代码6 项目: ClockPlus   文件: Utils.java
/**
 * 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);
    }
}
 
源代码7 项目: cathode   文件: Utils.java
/**
 * 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);
    }
}
 
源代码8 项目: Android-SwitchDateTimePicker   文件: Utils.java
/**
 * 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);
    }
}
 
源代码9 项目: date_picker_converter   文件: Utils.java
/**
 * 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);
    }
}
 
源代码10 项目: Trebuchet   文件: WallpaperPickerActivity.java
@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()));
}
 
源代码11 项目: DateTimepicker   文件: Utils.java
/**
 * 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);
    }
}
 
源代码12 项目: TurboLauncher   文件: WallpaperPickerActivity.java
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()));
}
 
源代码13 项目: Conquer   文件: Utils.java
/**
 * 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);
    }
}
 
源代码14 项目: SuntimesWidget   文件: SuntimesUtils.java
/**
 * @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);
                    }
                }
            }
        }
    }
}
 
源代码15 项目: StyleableDateTimePicker   文件: Utils.java
/**
 * 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);
    }
}
 
源代码16 项目: AlarmOn   文件: Utils.java
/**
 * 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);
    }
}
 
源代码17 项目: MaterialDateRangePicker   文件: Utils.java
/**
 * 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);
    }
}
 
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
}
 
源代码19 项目: MaterialDateTimePicker   文件: Utils.java
/**
 * 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);
    }
}
 
源代码20 项目: Pi-Locker   文件: ViewCompat_v16.java
/**
 * 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);
}
 
 方法所在类
 同类方法