Java Code Examples for android.view.View#sendAccessibilityEvent()

The following examples show how to use android.view.View#sendAccessibilityEvent() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: KUAS-AP-Material   File: PinnedSectionListView.java    License: MIT License 6 votes vote down vote up
private boolean performPinnedItemClick() {
	if (mPinnedSection == null) {
		return false;
	}

	OnItemClickListener listener = getOnItemClickListener();
	if (listener != null && getAdapter().isEnabled(mPinnedSection.position)) {
		View view = mPinnedSection.view;
		playSoundEffect(SoundEffectConstants.CLICK);
		if (view != null) {
			view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
		}
		listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id);
		return true;
	}
	return false;
}
 
Example 2
void dispatchOnDrawerClosed(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (lp.knownOpen) {
        lp.knownOpen = false;
        if (mListener != null) {
            mListener.onDrawerClosed(drawerView);
        }

        updateChildrenImportantForAccessibility(drawerView, false);

        // Only send WINDOW_STATE_CHANGE if the host has window focus. This
        // may change if support for multiple foreground windows (e.g. IME)
        // improves.
        if (hasWindowFocus()) {
            final View rootView = getRootView();
            if (rootView != null) {
                rootView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
            }
        }
    }
}
 
Example 3
Source Project: DrawerBehavior   File: BehaviorDelegate.java    License: Apache License 2.0 6 votes vote down vote up
private void dispatchOnDrawerClosed(View drawerView) {
  if ((openState & FLAG_IS_OPENED) == FLAG_IS_OPENED) {
    openState = 0;

    updateChildrenImportantForAccessibility(drawerView, false);

    // Only send WINDOW_STATE_CHANGE if the host has window focus. This
    // may change if support for multiple foreground windows (e.g. IME)
    // improves.
    if (parent.hasWindowFocus()) {
      final View rootView = parent.getRootView();
      if (rootView != null) {
        rootView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
      }
    }
  }
}
 
Example 4
public boolean performHeaderClick(View view, long id) {
    if (mOnHeaderClickListener != null) {
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        mOnHeaderClickListener.onHeaderClick(this, view, id);
        return true;
    }

    return false;
}
 
Example 5
Source Project: android-apps   File: IcsAdapterView.java    License: MIT License 5 votes vote down vote up
/**
 * Call the OnItemClickListener, if it is defined.
 *
 * @param view The view within the AdapterView that was clicked.
 * @param position The position of the view in the adapter.
 * @param id The row id of the item that was clicked.
 * @return True if there was an assigned OnItemClickListener that was
 *         called, false otherwise is returned.
 */
public boolean performItemClick(View view, int position, long id) {
    if (mOnItemClickListener != null) {
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        mOnItemClickListener.onItemClick(/*this*/null, view, position, id);
        return true;
    }

    return false;
}
 
Example 6
void setStateInternal(@State int state) {
    int previousState = this.state;

    if (this.state == state) {
        return;
    }
    this.state = state;

    if (viewRef == null) {
        return;
    }

    View bottomSheet = viewRef.get();
    if (bottomSheet == null) {
        return;
    }

    if (state == STATE_HALF_EXPANDED || state == STATE_EXPANDED) {
        updateImportantForAccessibility(true);
    } else if (state == STATE_HIDDEN || state == STATE_COLLAPSED) {
        updateImportantForAccessibility(false);
    }

    ViewCompat.setImportantForAccessibility(
            bottomSheet, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    bottomSheet.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);

    updateDrawableOnStateChange(state, previousState);
    if (callback != null) {
        callback.onStateChanged(bottomSheet, state);
    }
}
 
Example 7
public boolean performHeaderClick(View view, long id) {
    if (mOnHeaderClickListener != null) {
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        mOnHeaderClickListener.onHeaderClick(this, view, id);
        return true;
    }

    return false;
}
 
Example 8
public boolean performHeaderLongPress(View view, long id) {
    boolean handled = false;
    if (mOnHeaderLongClickListener != null) {
        handled = mOnHeaderLongClickListener.onHeaderLongClick(this, view, id);
    }

    if (handled) {
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
        }
        performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    }

    return handled;
}
 
Example 9
private boolean performPinnedItemClick() {
    if (mPinnedSection == null) return false;

    OnItemClickListener listener = getOnItemClickListener();
    if (listener != null && getAdapter().isEnabled(mPinnedSection.position)) {
        View view = mPinnedSection.view;
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id);
        return true;
    }
    return false;
}
 
Example 10
private boolean performPinnedItemClick() {
    if (mPinnedSection == null) return false;

    OnItemClickListener listener = getOnItemClickListener();
    if (listener != null) {
        View view =  mPinnedSection.view;
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id);
        return true;
    }
    return false;
}
 
Example 11
Source Project: something.apk   File: MarginDrawerLayout.java    License: MIT License 5 votes vote down vote up
void dispatchOnDrawerOpened(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (!lp.knownOpen) {
        lp.knownOpen = true;
        if (mListener != null) {
            mListener.onDrawerOpened(drawerView);
        }
        drawerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }
}
 
Example 12
Source Project: delion   File: CardUnmaskPrompt.java    License: Apache License 2.0 5 votes vote down vote up
private void setInitialFocus() {
    InputMethodManager imm = (InputMethodManager) mDialog.getContext().getSystemService(
            Context.INPUT_METHOD_SERVICE);
    View view = mShouldRequestExpirationDate ? mMonthInput : mCardUnmaskInput;
    imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
    if (sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptReadyForInput(this);
    }
}
 
Example 13
Source Project: zen4android   File: IcsAdapterView.java    License: MIT License 5 votes vote down vote up
/**
 * Call the OnItemClickListener, if it is defined.
 *
 * @param view The view within the AdapterView that was clicked.
 * @param position The position of the view in the adapter.
 * @param id The row id of the item that was clicked.
 * @return True if there was an assigned OnItemClickListener that was
 *         called, false otherwise is returned.
 */
public boolean performItemClick(View view, int position, long id) {
    if (mOnItemClickListener != null) {
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        mOnItemClickListener.onItemClick(/*this*/null, view, position, id);
        return true;
    }

    return false;
}
 
Example 14
Source Project: V.FlyoutTest   File: DrawerLayout.java    License: MIT License 5 votes vote down vote up
void dispatchOnDrawerOpened(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (!lp.knownOpen) {
        lp.knownOpen = true;
        if (mListener != null) {
            mListener.onDrawerOpened(drawerView);
        }
        drawerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }
}
 
Example 15
Source Project: 365browser   File: CardUnmaskPrompt.java    License: Apache License 2.0 5 votes vote down vote up
private void setInitialFocus() {
    InputMethodManager imm = (InputMethodManager) mDialog.getContext().getSystemService(
            Context.INPUT_METHOD_SERVICE);
    View view = mShouldRequestExpirationDate ? mMonthInput : mCardUnmaskInput;
    imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
    if (sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptReadyForInput(this);
    }
}
 
Example 16
private void setInitialFocus() {
    InputMethodManager imm = (InputMethodManager) mDialog.getContext().getSystemService(
            Context.INPUT_METHOD_SERVICE);
    View view = mShouldRequestExpirationDate ? mMonthInput : mCardUnmaskInput;
    imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
    if (sObserverForTest != null) {
        sObserverForTest.onCardUnmaskPromptReadyForInput(this);
    }
}
 
Example 17
Source Project: guideshow   File: DrawerLayout.java    License: MIT License 5 votes vote down vote up
void dispatchOnDrawerOpened(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (!lp.knownOpen) {
        lp.knownOpen = true;
        if (mListener != null) {
            mListener.onDrawerOpened(drawerView);
        }
        drawerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }
}
 
Example 18
private boolean performPinnedItemClick() {
    if (mPinnedSection == null) return false;

    OnItemClickListener listener = getOnItemClickListener();
    if (listener != null) {
        View view =  mPinnedSection.view;
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        listener.onItemClick(this, view, mPinnedSection.position, mPinnedSection.id);
        return true;
    }
    return false;
}
 
Example 19
/**
 * Call the OnItemClickListener, if it is defined. Performs all normal
 * actions associated with clicking: reporting accessibility event, playing
 * a sound, etc.
 *
 * @param view The view within the AdapterView that was clicked.
 * @param position The position of the view in the adapter.
 * @param id The row id of the item that was clicked.
 * @return True if there was an assigned OnItemClickListener that was
 *         called, false otherwise is returned.
 */
public boolean superPerformItemClick(View view, int position, long id) {
    if (mOnItemClickListener != null) {
        mOnItemClickListener.onItemClick(this, view, position, id);
        if (view != null) {
            view.playSoundEffect(SoundEffectConstants.CLICK);
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }
        return true;
    }

    return false;
}
 
Example 20
/**
 * Call the OnItemClickListener, if it is defined. Performs all normal
 * actions associated with clicking: reporting accessibility event, playing
 * a sound, etc.
 * 
 * @param view
 *            The view within the AdapterView that was clicked.
 * @param position
 *            The position of the view in the adapter.
 * @param id
 *            The row id of the item that was clicked.
 * @return True if there was an assigned OnItemClickListener that was
 *         called, false otherwise is returned.
 */
public boolean performItemClick(View view, int sectionIndex, int positionInSection, long id) {
	if (mOnItemClickListener != null) {
		// playSoundEffect(SoundEffectConstants.CLICK);
		if (view != null) {
			view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
		}
		mOnItemClickListener.onItemClick(this, getFreeFlowItemForVisibleItemAt(sectionIndex, positionInSection));
		return true;
	}

	return false;
}