android.view.View#sendAccessibilityEvent ( )源码实例Demo

下面列出了android.view.View#sendAccessibilityEvent ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: KUAS-AP-Material   文件: PinnedSectionListView.java
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;
}
 
源代码2 项目: adt-leanback-support   文件: DrawerLayout.java
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);
            }
        }
    }
}
 
源代码3 项目: DrawerBehavior   文件: BehaviorDelegate.java
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);
      }
    }
  }
}
 
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;
}
 
源代码5 项目: android-apps   文件: 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.
 */
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;
}
 
源代码6 项目: bottomsheetrecycler   文件: BottomSheetBehavior.java
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);
    }
}
 
源代码7 项目: o2oa   文件: StickyGridHeadersGridView.java
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;
}
 
源代码8 项目: o2oa   文件: StickyGridHeadersGridView.java
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;
}
 
源代码9 项目: AndroidWeekly   文件: PinnedSectionListView.java
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;
}
 
源代码10 项目: Kernel-Tuner   文件: PinnedSectionListView.java
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;
}
 
源代码11 项目: something.apk   文件: MarginDrawerLayout.java
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);
    }
}
 
源代码12 项目: delion   文件: CardUnmaskPrompt.java
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);
    }
}
 
源代码13 项目: zen4android   文件: 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.
 */
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;
}
 
源代码14 项目: V.FlyoutTest   文件: DrawerLayout.java
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);
    }
}
 
源代码15 项目: 365browser   文件: CardUnmaskPrompt.java
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);
    }
}
 
源代码16 项目: AndroidChromium   文件: CardUnmaskPrompt.java
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);
    }
}
 
源代码17 项目: guideshow   文件: DrawerLayout.java
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);
    }
}
 
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;
}
 
源代码19 项目: ticdesign   文件: TrackSelectionAdapterWrapper.java
/**
 * 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;
}
 
源代码20 项目: UltimateAndroid   文件: AbsLayoutContainer.java
/**
 * 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;
}
 
 方法所在类
 同类方法