Example usage for android.view View sendAccessibilityEvent

List of usage examples for android.view View sendAccessibilityEvent

Introduction

In this page you can find the example usage for android.view View sendAccessibilityEvent.

Prototype

public void sendAccessibilityEvent(int eventType) 

Source Link

Document

Sends an accessibility event of the given type.

Usage

From source file:nz.ac.otago.psyanlab.common.designer.program.stage.StageView.java

/**
 * Send any events and feedback that the long press action has taken place.
 *
 * @param handled True if the long press has taken place.
 * @param view    The view the long press was on.
 * @return Pass through of 'handled' parameter.
 */// w  ww  .  j a  v  a2 s. c  o  m
private boolean doLongPressFeedback(final boolean handled, final View view) {
    if (handled) {
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
        }
        performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
    }
    return handled;
}

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

/**
 * 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.
 *///from   www. j a  v a 2s. c  o m
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;
}

From source file:com.abewy.android.apps.klyph.widget.KlyphDrawerLayout.java

void dispatchOnDrawerOpened(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (!lp.knownOpen) {
        lp.knownOpen = true;/*w  w w .  j  a v a 2s .  co  m*/
        if (mListener != null) {
            mListener.onDrawerOpened(drawerView);
        }
        drawerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }
}

From source file:com.klinker.android.launcher.addons.view.LauncherDrawerLayout.java

void dispatchOnDrawerClosed(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (lp.knownOpen) {
        lp.knownOpen = false;/*from   w  w  w. ja v a 2  s .c  o m*/
        if (mListener != null) {
            mListener.onDrawerClosed(drawerView);
        }

        // 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);
            }
        }
    }
}

From source file:com.example.verticaldrawerlayout.VerticalDrawerLayout.java

void dispatchOnDrawerClosed(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (lp.knownOpen) {
        lp.knownOpen = false;//from  ww  w  .  jav a2  s . c o  m
        if (mListener != null) {
            mListener.onVerticalDrawerClosed(drawerView);
        }

        // If no drawer is opened, all drawers are not shown
        // for accessibility and the content is shown.
        View content = getChildAt(0);
        if (content != null) {
            ViewCompat.setImportantForAccessibility(content, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
        }
        ViewCompat.setImportantForAccessibility(drawerView,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);

        // 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);
            }
        }
    }
}

From source file:com.dk.view.FolderDrawerLayout.java

void dispatchOnDrawerClosed(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (lp.knownOpen) {
        lp.knownOpen = false;//from   www  . j a  v  a2  s.  c om
        if (mListener != null) {
            mListener.onDrawerClosed(drawerView);
        }
        // add by Dean Ding
        revertView();
        // 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);
            }
        }
    }
}

From source file:net.simonvt.staggeredgridview.StaggeredGridView.java

private void performClick(View view, int position, long id) {
    if (onItemClickListener != null) {
        playSoundEffect(SoundEffectConstants.CLICK);
        if (view != null) {
            view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_CLICKED);
        }/*from w ww .j  a  va2s .c om*/
        onItemClickListener.onItemClick(this, view, position, id);
    }
}

From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java

void dispatchOnDrawerClosed(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (lp.knownOpen) {
        lp.knownOpen = false;//from   w ww .  ja va 2s  . c om
        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);
            }
        }
    }
}

From source file:maximsblog.blogspot.com.formuladict.DrawerLayout.java

void dispatchOnDrawerClosed(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if ((lp.openState & LayoutParams.FLAG_IS_OPENED) == 1) {
        lp.openState = 0;/*ww  w  .j  ava2s .co m*/
        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);
            }
        }
    }
}

From source file:com.lansun.qmyo.view.DrawerLayout.java

void dispatchOnDrawerOpened(View drawerView) {
    final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if (!lp.knownOpen) {
        lp.knownOpen = true;//from w  w  w  .  ja va2 s  . c o m
        if (mListener != null) {
            // --------------------------------------------------------------------------------
            // ?? ???
            float minVel = MIN_FLING_VELOCITY * density;
            mLeftDragger.setMinVelocity(minVel);
            mRightDragger.setMinVelocity(minVel);
            // --------------------------------------------------------------------------------
            mListener.onDrawerOpened(drawerView);
        }
        drawerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }
}