Java Code Examples for android.view.accessibility.AccessibilityEvent

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 3

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 4

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 5

From project andlytics, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 6

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/accessibility/.

Source file: AccessibilityUtils.java

  22 
vote

/** 
 * Sends the specified text to the  {@link AccessibilityManager} to bespoken.
 * @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;
  }
  final AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
  event.setPackageName(PACKAGE);
  event.setClassName(CLASS);
  event.setEventTime(SystemClock.uptimeMillis());
  event.setEnabled(true);
  event.getText().add(text);
  mAccessibilityManager.sendAccessibilityEvent(event);
}
 

Example 7

From project androidZenWriter, under directory /library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 8

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/accessibility/.

Source file: AccessibilityUtils.java

  22 
vote

/** 
 * Sends the specified text to the  {@link AccessibilityManager} to bespoken.
 * @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;
  }
  final AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_FOCUSED);
  event.setPackageName(PACKAGE);
  event.setClassName(CLASS);
  event.setEventTime(SystemClock.uptimeMillis());
  event.setEnabled(true);
  event.getText().add(text);
  mAccessibilityManager.sendAccessibilityEvent(event);
}
 

Example 9

From project Common-Sense-Net-2, under directory /AndroidBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 10

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: AccessibilityEnableScriptInjectionPreference.java

  22 
vote

private void sendAccessibilityEvent(View view){
  AccessibilityManager accessibilityManager=AccessibilityManager.getInstance(getContext());
  if (mSendClickAccessibilityEvent && accessibilityManager.isEnabled()) {
    AccessibilityEvent event=AccessibilityEvent.obtain();
    event.setEventType(AccessibilityEvent.TYPE_VIEW_CLICKED);
    view.onInitializeAccessibilityEvent(event);
    view.dispatchPopulateAccessibilityEvent(event);
    accessibilityManager.sendAccessibilityEvent(event);
  }
  mSendClickAccessibilityEvent=false;
}
 

Example 11

From project cw-omnibus, under directory /external/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 12

From project DeskSMS, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 13

From project dmix, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 14

From project dreamDroid, under directory /libraries/ABS/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 15

From project examples_2, under directory /SearchView/actionbarsherlock-lib/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 16

From project farebot, under directory /libs/ActionBarSherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 17

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/library/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 18

From project GnucashMobile, under directory /com_actionbarsherlock/src/com/actionbarsherlock/internal/widget/.

Source file: IcsAdapterView.java

  22 
vote

@Override public boolean onRequestSendAccessibilityEvent(View child,AccessibilityEvent event){
  if (super.onRequestSendAccessibilityEvent(child,event)) {
    AccessibilityEvent record=AccessibilityEvent.obtain();
    onInitializeAccessibilityEvent(record);
    child.dispatchPopulateAccessibilityEvent(record);
    event.appendRecord(record);
    return true;
  }
  return false;
}
 

Example 19

From project connectbot, under directory /src/sk/vx/connectbot/.

Source file: TerminalView.java

  21 
vote

public void run(){
synchronized (mAccessibilityLock) {
    if (mCodeMatcher == null) {
      mCodeMatcher=mControlCodes.matcher(mAccessibilityBuffer);
    }
 else {
      mCodeMatcher.reset(mAccessibilityBuffer);
    }
    mAccessibilityBuffer=new StringBuffer(mCodeMatcher.replaceAll(" "));
    int i=mAccessibilityBuffer.indexOf(BACKSPACE_CODE);
    while (i != -1) {
      mAccessibilityBuffer=mAccessibilityBuffer.replace(i == 0 ? 0 : i - 1,i + BACKSPACE_CODE.length(),"");
      i=mAccessibilityBuffer.indexOf(BACKSPACE_CODE);
    }
    if (mAccessibilityBuffer.length() > 0) {
      AccessibilityEvent event=AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED);
      event.setFromIndex(0);
      event.setAddedCount(mAccessibilityBuffer.length());
      event.getText().add(mAccessibilityBuffer);
      sendAccessibilityEventUnchecked(event);
      mAccessibilityBuffer.setLength(0);
    }
  }
}
 

Example 20

From project android_7, under directory /src/org/immopoly/android/widget/.

Source file: ViewPager.java

  19 
vote

@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() == VISIBLE) {
      final ItemInfo ii=infoForChild(child);
      if (ii != null && ii.position == mCurItem && child.dispatchPopulateAccessibilityEvent(event)) {
        return true;
      }
    }
  }
  return false;
}
 

Example 21

From project android_packages_apps_CellBroadcastReceiver, under directory /src/com/android/cellbroadcastreceiver/.

Source file: CellBroadcastListItem.java

  19 
vote

@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  event.getText().add(mCbMessage.getSpokenDateString(getContext()));
  mChannelView.dispatchPopulateAccessibilityEvent(event);
  mMessageView.dispatchPopulateAccessibilityEvent(event);
  return true;
}
 

Example 22

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: CallCard.java

  19 
vote

@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  dispatchPopulateAccessibilityEvent(event,mUpperTitle);
  dispatchPopulateAccessibilityEvent(event,mPhoto);
  dispatchPopulateAccessibilityEvent(event,mManageConferencePhotoButton);
  dispatchPopulateAccessibilityEvent(event,mName);
  dispatchPopulateAccessibilityEvent(event,mPhoneNumber);
  dispatchPopulateAccessibilityEvent(event,mLabel);
  dispatchPopulateAccessibilityEvent(event,mSocialStatus);
  dispatchPopulateAccessibilityEvent(event,mSecondaryCallName);
  dispatchPopulateAccessibilityEvent(event,mSecondaryCallStatus);
  dispatchPopulateAccessibilityEvent(event,mSecondaryCallPhoto);
  return true;
}
 

Example 23

From project Barcamp-Bangalore-Android-App, under directory /slidingmenu/library/src/com/slidingmenu/lib/.

Source file: CustomViewAbove.java

  19 
vote

public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() == VISIBLE) {
      final ItemInfo ii=infoForChild(child);
      if (ii != null && ii.position == mCurItem && child.dispatchPopulateAccessibilityEvent(event)) {
        return true;
      }
    }
  }
  return false;
}
 

Example 24

From project cicada, under directory /samples/notifications/src/org/cicadasong/samples/notifications/.

Source file: NotificationAccessibilityService.java

  19 
vote

@Override protected void onServiceConnected(){
  AccessibilityServiceInfo info=new AccessibilityServiceInfo();
  info.eventTypes=AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
  info.feedbackType=AccessibilityServiceInfo.FEEDBACK_VISUAL;
  setServiceInfo(info);
  super.onServiceConnected();
}
 

Example 25

From project cornerstone, under directory /frameworks/base/core/java/android/view/.

Source file: ViewRootImpl.java

  19 
vote

/** 
 * The window is getting focus so if there is anything focused/selected send an  {@link AccessibilityEvent} to announce that.
 */
private void sendAccessibilityEvents(){
  if (!mAccessibilityManager.isEnabled()) {
    return;
  }
  mView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
  View focusedView=mView.findFocus();
  if (focusedView != null && focusedView != mView) {
    focusedView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
  }
}
 

Example 26

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/.

Source file: ActionBarSherlock.java

  19 
vote

/** 
 * Start an action mode.
 * @param callback Callback that will manage lifecycle events for thiscontext mode.
 * @return The ContextMode that was started, or null if it was canceled.
 * @see ActionMode
 */
public ActionMode startActionMode(ActionMode.Callback callback){
  if (mActionBar != null) {
    return mActionBar.startActionMode(callback);
  }
  if (mActionMode != null) {
    mActionMode.finish();
  }
  final ActionMode.Callback wrappedCallback=new ActionModeCallbackWrapper(callback);
  ActionMode mode=null;
  if (mActionModeView == null) {
    ViewStub stub=(ViewStub)mDecor.findViewById(R.id.abs__action_mode_bar_stub);
    if (stub != null) {
      mActionModeView=(ActionBarContextView)stub.inflate();
    }
  }
  if (mActionModeView != null) {
    mActionModeView.killMode();
    mode=new StandaloneActionMode(mActivity,mActionModeView,wrappedCallback,true);
    if (callback.onCreateActionMode(mode,mode.getMenu())) {
      mode.invalidate();
      mActionModeView.initForMode(mode);
      mActionModeView.setVisibility(View.VISIBLE);
      mActionMode=mode;
      mActionModeView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }
 else {
      mActionMode=null;
    }
  }
  if (mActionMode != null && mActivity instanceof OnActionModeStartedListener) {
    ((OnActionModeStartedListener)mActivity).onActionModeStarted(mActionMode);
  }
  return mActionMode;
}
 

Example 27

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: PhoneWindow.java

  19 
vote

@Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event){
  final Callback cb=getCallback();
  if (cb != null && !isDestroyed()) {
    if (cb.dispatchPopulateAccessibilityEvent(event)) {
      return true;
    }
  }
  return super.dispatchPopulateAccessibilityEvent(event);
}
 

Example 28

From project Google-Tasks-Client, under directory /actionbarsherlock/src/com/actionbarsherlock/internal/app/.

Source file: ActionBarImpl.java

  19 
vote

public ActionMode startActionMode(ActionMode.Callback callback){
  boolean wasHidden=false;
  if (mActionMode != null) {
    wasHidden=mWasHiddenBeforeMode;
    mActionMode.finish();
  }
  mContextView.killMode();
  ActionModeImpl mode=new ActionModeImpl(callback);
  if (mode.dispatchOnCreate()) {
    mWasHiddenBeforeMode=!isShowing() || wasHidden;
    mode.invalidate();
    mContextView.initForMode(mode);
    animateToMode(true);
    if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
      mSplitView.setVisibility(View.VISIBLE);
    }
    mContextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    mActionMode=mode;
    return mode;
  }
  return null;
}