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

The following are Jave code examples for showing how to use sendAccessibilityEvent() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: chromium-for-android-56-debug-video   File: Tab.java   Source Code and License Vote up 7 votes
/**
 * Update whether or not the current native tab and/or web contents are
 * currently visible (from an accessibility perspective), or whether
 * they're obscured by another view.
 */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility()
                ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility()
                || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
 
Example 2
Project: letv   File: DrawerLayout.java   Source Code and License Vote up 6 votes
void dispatchOnDrawerClosed(View drawerView) {
    LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if ((lp.openState & 1) == 1) {
        lp.openState = 0;
        if (this.mListeners != null) {
            for (int i = this.mListeners.size() - 1; i >= 0; i--) {
                ((DrawerListener) this.mListeners.get(i)).onDrawerClosed(drawerView);
            }
        }
        updateChildrenImportantForAccessibility(drawerView, false);
        if (hasWindowFocus()) {
            View rootView = getRootView();
            if (rootView != null) {
                rootView.sendAccessibilityEvent(32);
            }
        }
    }
}
 
Example 3
Project: superglue   File: DebugDrawerLayout.java   Source Code and License Vote up 6 votes
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 4
Project: superglue   File: DebugDrawerLayout.java   Source Code and License Vote up 6 votes
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 5
Project: boohee_v5.6   File: DrawerLayout.java   Source Code and License Vote up 6 votes
void dispatchOnDrawerClosed(View drawerView) {
    LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
    if ((lp.openState & 1) == 1) {
        lp.openState = 0;
        if (this.mListeners != null) {
            for (int i = this.mListeners.size() - 1; i >= 0; i--) {
                ((DrawerListener) this.mListeners.get(i)).onDrawerClosed(drawerView);
            }
        }
        updateChildrenImportantForAccessibility(drawerView, false);
        if (hasWindowFocus()) {
            View rootView = getRootView();
            if (rootView != null) {
                rootView.sendAccessibilityEvent(32);
            }
        }
    }
}
 
Example 6
Project: GitHub   File: PinnedSectionListView.java   Source Code and License Vote up 5 votes
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 7
Project: CSipSimple   File: IcsAdapterView.java   Source Code and License Vote up 5 votes
/**
 * 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 8
Project: chromium-for-android-56-debug-video   File: CardUnmaskPrompt.java   Source Code and License Vote up 5 votes
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 9
Project: letv   File: AdapterView.java   Source Code and License Vote up 5 votes
public boolean performItemClick(View view, int position, long id) {
    if (this.mOnItemClickListener == null) {
        return false;
    }
    playSoundEffect(0);
    if (view != null) {
        view.sendAccessibilityEvent(1);
    }
    this.mOnItemClickListener.onItemClick(this, view, position, id);
    return true;
}
 
Example 10
Project: exciting-app   File: AdapterView.java   Source Code and License Vote up 5 votes
/**
 * 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 col 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, view, position, id );
		return true;
	}

	return false;
}
 
Example 11
Project: FreeStreams-TVLauncher   File: AdapterView.java   Source Code and License Vote up 5 votes
public boolean performItemClick(View paramView, int paramInt, long paramLong) {
	if (this.mOnItemClickListener != null) {
		playSoundEffect(0);
		if (paramView != null)
			paramView.sendAccessibilityEvent(1);
		this.mOnItemClickListener.onItemClick(this, paramView, paramInt, paramLong);
		return true;
	}
	return false;
}
 
Example 12
Project: Idea-ChainSelector   File: PinnedSectionListView.java   Source Code and License Vote up 5 votes
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 13
Project: CitySelct   File: PinnedSectionListView.java   Source Code and License Vote up 5 votes
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 14
Project: EsperantoRadio   File: PinnedSectionListView.java   Source Code and License Vote up 5 votes
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 15
Project: RNLearn_Project1   File: AccessibilityHelper.java   Source Code and License Vote up 4 votes
public static void sendAccessibilityEvent(View view, int eventType) {
  view.sendAccessibilityEvent(eventType);
}
 
Example 16
Project: RNLearn_Project1   File: AccessibilityHelper.java   Source Code and License Vote up 4 votes
public static void sendAccessibilityEvent(View view, int eventType) {
  view.sendAccessibilityEvent(eventType);
}
 
Example 17
Project: GitHub   File: AbsLayoutContainer.java   Source Code and License Vote up 3 votes
/**
 * 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;
}