Example usage for android.view.accessibility AccessibilityEvent TYPE_VIEW_SELECTED

List of usage examples for android.view.accessibility AccessibilityEvent TYPE_VIEW_SELECTED

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityEvent TYPE_VIEW_SELECTED.

Prototype

int TYPE_VIEW_SELECTED

To view the source code for android.view.accessibility AccessibilityEvent TYPE_VIEW_SELECTED.

Click Source Link

Document

Represents the event of selecting an item usually in the context of an android.widget.AdapterView .

Usage

From source file:com.actionbarsherlock.internal.widget.IcsAdapterView.java

void selectionChanged() {
    if (mOnItemSelectedListener != null) {
        if (mInLayout || mBlockLayoutRequests) {
            // If we are in a layout traversal, defer notification
            // by posting. This ensures that the view tree is
            // in a consistent state and is able to accomodate
            // new layout or invalidate requests.
            if (mSelectionNotifier == null) {
                mSelectionNotifier = new SelectionNotifier();
            }//  w  w w  . j  ava  2s.com
            post(mSelectionNotifier);
        } else {
            fireOnSelected();
        }
    }

    // we fire selection events here not in View
    if (mSelectedPosition != ListView.INVALID_POSITION && isShown() && !isInTouchMode()) {
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
    }
}

From source file:com.android.screenspeak.contextmenu.RadialMenuView.java

/**
 * Called when an item is focused. If the newly focused item is the same as
 * the previously focused item, this is a no-op. Otherwise, the menu item's
 * select action is triggered and an accessibility select event is fired.
 *
 * @param item The item that the user focused.
 */// w w  w  . ja v  a  2 s  . c  o m
private void onItemFocused(RadialMenuItem item) {
    if (mFocusedItem == item) {
        return;
    }

    final RadialMenu menu = (mSubMenu != null) ? mSubMenu : mRootMenu;

    mFocusedItem = item;

    invalidate();

    if (item == null) {
        menu.clearSelection(0);
    } else if (item.isCorner()) {
        // Currently only the root menu is allowed to have corners.
        mRootMenu.selectMenuItem(item, 0);
    } else {
        menu.selectMenuItem(item, 0);
    }

    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
}

From source file:com.android.contacts.list.DefaultContactBrowseListFragment.java

@Override
protected void setListHeader() {
    if (!isSearchMode()) {
        return;/*  w  w  w .ja  v  a  2s . c  om*/
    }
    ContactListAdapter adapter = getAdapter();
    if (adapter == null) {
        return;
    }

    // In search mode we only display the header if there is nothing found
    if (TextUtils.isEmpty(getQueryString()) || !adapter.areAllPartitionsEmpty()) {
        mSearchHeaderView.setVisibility(View.GONE);
        showSearchProgress(false);
    } else {
        mSearchHeaderView.setVisibility(View.VISIBLE);
        if (adapter.isLoading()) {
            mSearchProgressText.setText(R.string.search_results_searching);
            showSearchProgress(true);
        } else {
            mSearchProgressText.setText(R.string.listFoundAllContactsZero);
            mSearchProgressText.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
            showSearchProgress(false);
        }
    }
}

From source file:io.authme.sdk.widget.LockPatternView.java

private void sendAccessEvent(int resId) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        setContentDescription(getContext().getString(resId));
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
        setContentDescription(null);/*w w w  . ja v a  2  s . c om*/
    } else
        announceForAccessibility(getContext().getString(resId));
}

From source file:com.aliasapps.seq.scroller.TwoWayView.java

private void performAccessibilityActionsOnSelected() {
    final int position = getSelectedItemPosition();
    if (position >= 0) {
        // We fire selection events here not in View
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
    }/*  w w w .  ja v  a2 s .  c om*/
}