AccessibilityManager sendAccessibilityEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AccessibilityManager sendAccessibilityEvent method.

This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
     * enabled. No operation if accessibility is disabled. 
     * 
     * @param event The event to send. 
     */ 
    public void requestSendAccessibilityEvent(final AccessibilityEvent event) {
        if (mAccessibilityManager.isEnabled()) {
            mAccessibilityManager.sendAccessibilityEvent(event);
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:interrupt, isEnabled, sendAccessibilityEvent
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
     * spoken. 
     * 
     * @param text the text to speak 
     */ 
    public void speak(CharSequence text) {
        if (!mAccessibilityManager.isEnabled()) {
            Log.e(TAG, "Attempted to speak when accessibility was disabled!");
            return; 
        } 
 
        // The following is a hack to avoid using the heavy-weight TextToSpeech 
        // class. Instead, we're just forcing a fake AccessibilityEvent into 
        // the screen reader to make it speak. 
        final AccessibilityEvent event = AccessibilityEvent
                .obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
 
        event.setPackageName(PACKAGE);
        event.setClassName(CLASS);
        event.setEventTime(SystemClock.uptimeMillis());
        event.setEnabled(true);

5
CodeRank
This code example shows how to use the following methods:interrupt, isEnabled, sendAccessibilityEvent
				); 
	} 
 
	private void speakText(String text, int queueMode) 
	{ 
		if(aManager.isEnabled()) 
		{ 
			aManager.interrupt();
 
			AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
			event.setPackageName(this.getClass().getPackage().toString());
			event.setClassName(this.getClass().getSimpleName());
			event.setContentDescription(text);
			event.setEventTime(System.currentTimeMillis());
			aManager.sendAccessibilityEvent(event);
		} 
	} 
 
	/** 
	 * Handles the communication between the JS and this class. 
5
CodeRank
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
     * spoken. 
     * 
     * @param text the text to speak 
     */ 
    public void speak(CharSequence text) {
        if (!mAccessibilityManager.isEnabled()) {
            Log.e(TAG, "Attempted to speak when accessibility was disabled!");
            return; 
        } 
 
        // The following is a hack to avoid using the heavy-weight TextToSpeech 
        // class. Instead, we're just forcing a fake AccessibilityEvent into 
        // the screen reader to make it speak. 
        final AccessibilityEvent event = AccessibilityEvent
                .obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
 
        event.setPackageName(PACKAGE);
        event.setClassName(CLASS);
        event.setEventTime(SystemClock.uptimeMillis());
        event.setEnabled(true);

5
CodeRank
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
     * enabled. No operation if accessibility is disabled. 
     * 
     * @param event The event to send. 
     */ 
    public void requestSendAccessibilityEvent(AccessibilityEvent event) {
        if (mAccessibilityManager.isEnabled()) {
            mAccessibilityManager.sendAccessibilityEvent(event);
        } 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
     * spoken. 
     * 
     * @param text the text to speak 
     */ 
    public void speak(CharSequence text) {
        if (!mAccessibilityManager.isEnabled()) {
            Log.e(TAG, "Attempted to speak when accessibility was disabled!");
            return; 
        } 
 
        // The following is a hack to avoid using the heavy-weight TextToSpeech 
        // class. Instead, we're just forcing a fake AccessibilityEvent into 
        // the screen reader to make it speak. 
        final AccessibilityEvent event = AccessibilityEvent
                .obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
 
        event.setPackageName(PACKAGE);
        event.setClassName(CLASS);
        event.setEventTime(SystemClock.uptimeMillis());
        event.setEnabled(true);

5
CodeRank
This code example shows how to use the following methods:isEnabled, sendAccessibilityEvent
     * spoken. 
     * 
     * @param text the text to speak 
     */ 
    public void speak(CharSequence text) {
        if (!mAccessibilityManager.isEnabled()) {
            Log.e(TAG, "Attempted to speak when accessibility was disabled!");
            return; 
        } 
 
        // The following is a hack to avoid using the heavy-weight TextToSpeech 
        // class. Instead, we're just forcing a fake AccessibilityEvent into 
        // the screen reader to make it speak. 
        final AccessibilityEvent event = AccessibilityEvent
                .obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
 
        event.setPackageName(PACKAGE);
        event.setClassName(CLASS);
        event.setEventTime(SystemClock.uptimeMillis());
        event.setEnabled(true);

4
CodeRank

Related AccessibilityManager sendAccessibilityEvent Questions & Answers:

sendAccessibilityEvent Method Overview
Sends an AccessibilityEvent.
See Code Examples for other Android AccessibilityManager Methods: